Jump to content

mysql lost password


Gowator
 Share

Recommended Posts

got this from a certain linux cookbook, honestly.. have not tried it yet in actual, so try to do it on your test box first, assuming that u forgot the mysql passwd on that box... to see if it will work..

Recovering and Changing Your MySQL Root Password

 

Sometimes you may have to recover the MySQL root password because it was either forgotten or misplaced. The steps you need are:

 

1. Stop MySQL:

 

[root@geek tmp]# service mysqld stop

Stopping MySQL: [ OK ]

[root@geek tmp]#

 

2.Start MySQL in Safe mode with the safe_mysqld command and tell it not to read the grant tables with all the MySQL database passwords:

 

[root@geek tmp]# safe_mysqld --skip-grant-tables &

[1] 4815

[root@geek tmp]# Starting mysqld daemon with databases from

/var/lib/mysql

[root@geek tmp]#

 

3.Use the mysqladmin command to reset the root password. In this case, you are setting it to

 

thisisthepassword

 

[root@geek tmp]# mysqladmin -u root flush-privileges password "thisisthepassword"

[root@geek tmp]#

 

 

4.Restart MySQL normally:

 

 

[root@geek tmp]# service mysqld restart

Stopping MySQL: 040517 09:39:38 mysqld ended

[ OK ]

Starting MySQL: [ OK ]

[1]+ Done safe_mysqld --skip-grant-tables

[root@geek tmp]#

 

The MySQL root user will now be able to manage MySQL using this new password.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...