Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR: Access denied for user: 'root@localhost'

Status
Not open for further replies.

mar75

Programmer
Aug 9, 2000
2
CA
I recently installed Linux-Mandrake 6.1 which came with MySql version 3.20.32a, and 3.22.25.&nbsp;&nbsp;I installed both as I opted to install all packages that came with Mandrake at installation time.<br><br>Here is what happend when I tried to use mysql for the first time:<br><br># mysql -u root mysql<br>Worked just fine, got mysql prompt and no error message.<br><br>I continued the testing as outlined in the mysql manual:<br># mysqladmin -u root shutdown<br># safe-mysqld --log &<br>&nbsp;&nbsp;[1]727<br>&nbsp;&nbsp;Starting mysqld demon with databases from /var/lib/mysql<br><br>After this anything I tried eg:<br>&nbsp;&nbsp;&nbsp;&nbsp;mysql -u root mysql<br>&nbsp;&nbsp;&nbsp;&nbsp;mysqladmin version<br>&nbsp;&nbsp;&nbsp;&nbsp;mysqlshow mysql<br>&nbsp;&nbsp;&nbsp;&nbsp;mysql -u root test <br><br>results in the following error message: <br><br>Error: Access denied for user:&nbsp;&nbsp;'root@localhost' to database 'mysql'<br><br>I should mention that if I try <br><br>mysql -u any_user_except_root test<br><br>I get the mysql prompt no problem, however mysql -u any_user mysql results in the same access denied error message<br><br>I have read the mysql manual and tried everthing that was recommended without any success. <br><br>Any thoughts, suggestions, comments on this will be much appreciated also this might be a stupid question (i am a linux newbie) but could the fact that I have two versions of mysql installed have something to do with my problem.&nbsp;&nbsp;<br><br>Thank you&nbsp;&nbsp;&nbsp;<br><br>&nbsp;
 
The formal syntax for executing the mysql client is <br><br>#mysql -u [user] -h [hostname] -p<br>The -p option prompts for a password before letting you in.<br>If left out, the -h option is by default 'localhost', but you might try -h [your hostname_or_IP address]<br><br>Having two versions of mysql running could be your problem. I would just use the RPM package manager in X-windows (I believe it is krpm or gnorpm) to uninstall the older version 3.20.32a, and then if you still have trouble with the other one, uninstall and reinstall.<br><br>Generally, before doing anything else in mysql, you run<br>#mysqladmin -u root -h localhost password [enter_password], so you at least have defined a root password. Then after that, anytime you want to enter as root, you enter<br>#mysql -u root -h locahost[or hostname] -p<br><br>
 
Hi thanks for your help!<br><br>I have solved my problem and I thought I should let people know what I did as it seems that&nbsp;&nbsp;&quot;error: access denied&quot; is quite a common problem.<br><br>Well first I have to admit that I made a pretty stupid mistake.&nbsp;&nbsp;After retracing all my steps (I took notes) it turned out that I did specify a password for root somewhere along the way and that was what was causing the problem.&nbsp;&nbsp;&nbsp;I did at some point try this new password but got &quot;error:access denied&quot;&nbsp;&nbsp;I figured that since the password did not work (I must have entered it wrong)&nbsp;&nbsp;it must have been something else that was causing the problem.&nbsp;&nbsp;<br><br><br>Well needless to say I feel very embarrased but I have learned my lesson!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top