Gowator 0 Report post Posted June 3, 2006 I somehow messed up the root password for mysql.... anyone please know a way to reset it without loosing the databases? Quote Share this post Link to post Share on other sites
aioshin 0 Report post Posted June 3, 2006 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. Quote Share this post Link to post Share on other sites