How to reset the root password for MySQL

13 Aug, 2008  |  Posted by Danesh  |  in HowTo, Linux

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.

  • Digg
  • del.icio.us
  • BlinkList
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Furl
  • Google
  • Live
  • Facebook
  • Pownce
  • TwitThis
  • E-mail this story to a friend!
Tags: , , , , ,

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>