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
1 | $ service mysql stop |
2. Start MySQL in safe mode without a password
1 | $ mysqld_safe --skip-grant-tables & |
3. Log into your database server without a password, and reset the MySQL root password
1 | $ mysql -uroot |
1 2 3 4 | 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
1 2 3 | $ service mysql stop $ service mysql start $ mysql -uroot -p |