Reset mysql 'root' password

by Sanju 2012-05-18 14:35:13

1. Stop MySQL:

/etc/init.d/mysql stop

2. Start the MySQL server without privilege tables:

mysqld --skip-grant-tables

3. Start the mysql client:

mysql

4. Find name of admin user (probably 'root'), update password:

select user,host,password from mysql.user;

-- reset password for admin user 'root' (or whatever the name is)

update mysql.user set password=PASSWORD('new_pass') where user='root';
flush privileges;
exit;

5. Stop mysqld, eg in another command window...

mysqladmin shutdown

4. Restart MySQL:

/etc/init.d/mysql start

Tagged in:

955
like
0
dislike
0
mail
flag

You must LOGIN to add comments