Mysql error 1045: Access denied for user 'root'@'localhost' (using password: YES)
Hi,
I was setting up mysql server on my box running Fedora Core 13. Please see the version below - " mysql Ver 14.14 Distrib 5.1.51, for redhat-linux-gnu (i386) using readline 5.1 " I ran /usr/bin/mysql_secure_installation for some configurations Gave root password, restarted mysqld service and did this - $ mysql -u root -p It allowed me to log in. Then I imported a test.sql db. Rebooted the box. Now when I tried to login to mysql - I get the following error even after keying in the correct password. 1045: Access denied for user 'root'@'localhost' (using password: YES) I have not installed phpmyadmin yet. I went through MySql forums, didn't find any valuable post which could solve this. Some said to re-install Mysql, I did so, it worked perfectly until box was rebooted. Same error promts when I login next time. It would be a great if anyone in this forum can support me here. It has become a blocker for my development work as well. Many thanks, |
Hi, a very basic question.... are you able to log in as a normal user. If you can do that then try to run su or sudo and become root.
Hope this helps. |
Looks like SilverBack got the wrong end of the stick there. The OP said he couldn't log into mysql, not into a console.
Try this http://dev.mysql.com/doc/refman/5.0/...rmissions.html Not sure why it'd change the root password when you reboot though. |
@SilverBack
I am not able to get the mysql> promt in both ways -as 'normal' or 'su -' @Flyte I did visit that link earlier, it couldn't change mysql password. Or if it would have changed it is not allowing me in with new password. When I remove /var/lib/mysql directory and re-install mysql. it works! I am able to login to mysql, change DB and say >grant all privileges on DB.* to user@localhost identified by pswd; I get encounter new error - "ERROR 1133 (42000): Can't find any matching row in the user table" When I exit out of mysql> and try logging in it doesn't allow. (Error 1045) |
Are you sure you have a password set for the user? If not then try logging without the -p switch and see if you can log into mysql.
|
@Chaitanya ---- you got it right mate. I did not know what I was thinking (ssh perhaps). Thanks for pointing the error.
|
@Silver:
Yeah monday is anyhow an awful way to spend 1/7th of week. let monday go and you will be back in your senses. Diwali fervour has not sunk in yet with me as well. ;) |
Quote:
Any more pointers ? Thanks, |
Okay you rebooted the server. Are you sure the service is running? What does this give you:
Code:
/etc/init.d/mysqld status |
@Chaitanya
After rebooting my box ; /etc/init.d/mysqld says..service is running. I do check mysqld.pid under /var/run/mysqld/ directory. I tried killing it and restarting service ; service restarts but my login issue is not resolved. Thanks, |
You said you imported some sql script? What script was it? Or was it for creating the database? Do you have by chance, any other user created on mysql with super privileges?
|
That was a testdb.sql file which contains some tables / data.
I said : $ mysql -u root -p < testdb.sql No, I do not have any other user. Quote:
|
Are you sure that sql import did not affect this all? Can you see what that sql script contains?
|
Same issue here but on slackware. I found this guide http://www.basicconfig.com/linuxserv...ysql_slackware
can sign in fine as root but denied access to do anything. |
Quote:
$ echo "" > blank.sql $ mysql -u root -p < blank.sql This got imported and when I logged in to mysql> and logged out of mysql> I was unable to login for the next time. But, again as per you said, let me go through main DB .sql file and grep for "user". If this returns something unexpected. I think we are close to results then. Thanks, |
You may want to look into it. I have a running mysql server on CentOS5 and I do import and export data and sql scripts but this never has happened. And I got another account with super privileges other than root. Both are password protected. And I tend not to use root account.
|
All times are GMT -5. The time now is 03:50 PM. |