MySQL Password Recovery

1. Stop mysql
# /etc/init.d/mysql stop

2. Start mysql without password:
# mysqld_safe –skip-grant-tables &

3. Connect to mysql server
# mysql -u root

4. Update root password
mysql> use mysql;
mysql> update user set password=PASSWORD(“new_password”) where User=’root’;
mysql> flush privileges;
mysql> quit

5. Restart mysql
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

6. Connect mysql using new password
# mysql -u root -p

Leave a Reply

Your email address will not be published. Required fields are marked *