Search form

Reset the MySQL Root Password

So you don't know your MySQL root password but you do have the root password of the server. Here's a quick way to reset your MySQL root password on the command line:

1. Stop MySQL

$ service mysql stop

2. Start MySQL in safe mode without a password

$ mysqld_safe --skip-grant-tables &

3. Log into your database server without a password, and reset the MySQL root password

$ mysql -uroot
mysql> USE mysql;
mysql> update user set password=PASSWORD("blarblarblar") where User='root';
mysql> flush privileges;
mysql> quit

4. Stop/restart MySQL and log in normally

$ service mysql stop
$ service mysql start
$ mysql -uroot -p

Categories: 

Looking for affordable web hosting? Try GreenGeeks for only $3.95/mo. (I'm both an affiliate and a client.)

I participate in the Amazon Associates program. Making your Amazon purchases through my affiliate links supports this site at no additional cost to you: