Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
04-30-2004, 04:05 AM
|
#1
|
Member
Registered: Dec 2003
Location: Johannesburg, South Africa
Distribution: Mandrake
Posts: 48
Rep:
|
mysql: still can't login after root password reset
please help - I've managed to forget my root password and could not log into mysql. I then:
1. stopped mysqld, and restarted with --skip-grant-tables.
2. changed the root password by updating mysql.user
3. flushed privileges
4. restarted mysqld
when trying to start with 'mysql -u root mysql' i get logged in but whenever I try to do something I get
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
when trying to start with 'mysql -p -u root mysql' so i get prompted for my password and i type it in, i get:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
please help this thing is driving me up the wall. as you've probably seen above i'm no mysql expert.
thanks
andre
|
|
|
05-06-2004, 02:43 AM
|
#2
|
Member
Registered: Dec 2003
Location: Johannesburg, South Africa
Distribution: Mandrake
Posts: 48
Original Poster
Rep:
|
ok, after several hair-pulling-out-in-frustration days i've managed to crack this one so here's the answer IF anybody happens to be interested. The insert to change your password must be in the format:
update mysql.user set password=PASSWORD('password') where user='root';
note the password() function. i'm amazed nobody could help me on this one, on all the forums where i looked the function was not used so the password is inserted in plain text.
|
|
|
12-27-2012, 05:10 PM
|
#3
|
LQ Newbie
Registered: Dec 2012
Posts: 1
Rep: 
|
Thank you!
Almost 9 years later, I created a new account on this forum just to thank you for the time you took to write the solution to my problem! I spent around 5-6 hours trying to figure this out reading dozens of articles and documentation and thanks to you I was able to solve this problem (which took many production servers down).
And yes, if you get the error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)" you need to:
1. Stop mysqld, type skip-grant-tables under [mysqld] within the /etc/my.cnf file.
2. Start mysqld
3. login with root mysql -u root -p
4. enter the following command: update mysql.user set password=PASSWORD('password') where user='root';
3. flush privileges
4. restart mysqld
|
|
|
12-27-2012, 09:48 PM
|
#4
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 11,370
|
Also, do not forget to erase the "mysql.log" file after you're done. (You must exit "mysql" command first.) Otherwise the command you just entered will be there along with the password. 
|
|
|
12-19-2014, 06:30 PM
|
#5
|
LQ Newbie
Registered: Dec 2014
Posts: 1
Rep: 
|
mysql: still can't login after root password reset
Hi,
@Den
If you add skip-grant-tables under [mysqld] within the /etc/my.cnf file, and do below:
2. Start mysqld
3. login with root mysql -u root -p
4. enter the following command: update mysql.user set password=PASSWORD('password') where user='root';
3. flush privileges
4. restart mysqld
wont fix the issue because it will give an access to any password for root user. Feel free to give it a try.
login with root mysql -u root -p
and type any password and see you will be at mysql prompt which should not happen.
|
|
|
All times are GMT -5. The time now is 08:04 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|