How to reset the root password for MySQL

13 Aug
2008


It happens, you set a super complicated password for your MySQL root account and 2 months down the road forget what it was.

Here’s how you’d fix that.

1. Stop your current MySQL database if it is running

root@abubu# service mysqld stop

2. Start MySQL in safe mode and bypass reading the privilege table.

root@abubu# mysqld_safe --skip-grant-tables

3. Reset your root password MySQL console. If it goes well you will not need to key in a password.

root@abubu# mysql -u root mysql

mysql> update user set Password=PASSWORD('new-password');
mysql> flush privileges;
mysql exit;

4. Kill the MySQL process and restart MySQL normally.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • Identi.ca
  • LinkedIn
  • Turn this article into a PDF!
  • Ping.fm
  • StumbleUpon
  • MySpace
  • Twitter

Comment Form

top