How to reset root password on mysql server

On 26 April 2011, in Mysql, by Himselff

1. Stop MySQL services

2.  Start them back in safe mode (mysqld_safe –skip-grant-tables &)

3. mysql -u root mysql

4. At the prompt, run the following command, changing abcd by your new password :

UPDATE user SET password=PASSWORD(“abcd”) WHERE user=”root”;
FLUSH PRIVILEGES;

5. There you go , just enter that command to test, it will prompt for the password :

mysql -uroot -p

Tagged with:  

Comments are closed.