Resetting MySQL password in Linux
After a clean install of MySQL in Fedora 13 I found myself in the position of being unable to set a root password as one had somehow already been created. The situation of forgetting a password is much more likely, never the less the steps are the same:
Kill the mysql service
[root@host /]# service mysqld stopStart the service with disabled grant tables
[root@host /]# /usr/bin/mysqld_safe --skip-grant-tables &Open a SQL command prompt
[root@host /]# mysqlConnect to the DB
mysql> use mysqlView users
mysql> SELECT * FROM `user`;Reset the user password (’root’ can be any user and ‘newpassword’ any password)
mysql> UPDATE `user` SET `password` = PASSWORD('newpassword') WHERE `User` = 'root';Quit SQL
mysql> exitRestart the service
[root@host /]# service mysqld restart
No comments
Jump to comment form | comments rss [?] | trackback uri [?]