Mysql error 1045: Access denied for user 'root'@'localhost' (using password: YES)
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26
Rep:
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.
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26
Original Poster
Rep:
@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)
@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.
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26
Original Poster
Rep:
@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.
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?
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26
Original Poster
Rep:
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:
Originally Posted by linuxlover.chaitanya
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?
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26
Original Poster
Rep:
Quote:
Originally Posted by linuxlover.chaitanya
Are you sure that sql import did not affect this all? Can you see what that sql script contains?
No, I do not think so that sql import has caused any issue. When I re-installed Fedora for third time, I tried with empty .sql file
$ 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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.