LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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



Reply
 
Search this Thread
Old 12-03-2005, 03:31 PM   #1
slackhack
Senior Member
 
Registered: Jun 2004
Distribution: Arch, Debian, Slack
Posts: 1,016

Rep: Reputation: 46
lost mysql password, can't recover


i've tried at least half a dozen different methods from all over the web, but all of them fail. the usual procedure is some variation of this:

1. kill all mysql stuff
2. mysqld_safe --skip-grant-tables &
3. mysql
4. update user set password = password('password') where user = 'root' and host='localhost';
whereupon i get a:

Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0

looks good, so:

5. flush privileges;
6. quit
7. ./mysql stop
8. ./mysql start
9. root@host:/etc/init.d # mysql -u root -p mysql
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


???

sometimes i exit and then flush privileges with mysqladmin, sometimes i don't flush privileges, but nothing works. sometimes with one of the password syntaxes i found at one of the sites somewhere i get a "you launched mysql as --skip-grant-tables so you can do that."

something happened in phpmyadmin, i think, but i'm new to both of those programs so i'm not sure what i might have done. but now i can't log into either.

-------------------
SOLVED

i finally had to apt-get --purge all the mysql stuff and reinstall. before that i tried moving the mysql tables and regenerating the install_db, but then i started getting all kinds of errors about the debian-sys-maint account not having the right permissions or something. now everything seems to be working.

Last edited by slackhack; 12-03-2005 at 05:46 PM.
 
Old 12-03-2005, 06:15 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Quote:
1. kill all mysql stuff
2. mysqld_safe --skip-grant-tables &
3. mysql
4. update user set password = password('password') where user = 'root' and host='localhost';
whereupon i get a:

Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0

<= THIS IS BAD: IT MEANS THE "UPDATE USER" DIDN'T UPDATE ANYTHING
Since you've got everything working by completely reinstalling, I guess the point is moot.

Please try this:
Code:
mysql> select Host,User,ssl_type,max_connections from user;
+----------------+---------+----------+-----------------+
| Host           | User    | ssl_type | max_connections |
+----------------+---------+----------+-----------------+
| localhost      | root    |          |               0 |
| linuxdev1.site | root    |          |               0 |
| %              | srccorp |          |               0 |
+----------------+---------+----------+-----------------+
3 rows in set (0.00 sec)
I suspect the problem you might have had before the re-install was that you didn't have a "User" named "root", and/or a "host" named "localhost".

Anyway, glad you got it fixed!

Your .. PSM
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql root password lost nazir Linux - Software 6 10-09-2007 11:18 AM
Recover MySQL password wwnexc Linux - Security 2 10-16-2005 02:08 PM
How to recover a lost username / password for Solaris 7 at gui login screen noitwhiz Solaris / OpenSolaris 2 09-29-2004 01:32 PM
Loaded Linux, lost login ID and password for superuser? How can I recover? PaulK Linux - Newbie 3 08-24-2004 11:01 PM
Data Lost! Is It Possible To Recover? rddreamz Linux - Newbie 3 11-17-2003 11:15 PM


All times are GMT -5. The time now is 10:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration