Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/sgreimer/stevenreimer.com/includes/utilities/library.php on line 660

Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/sgreimer/stevenreimer.com/includes/Page.class.php on line 574
StevenReimer.com :: Home

I have had to reset a MySQL root password a few times recently so I should probably write it down.

First, stop the currently running MySQL database daemon

sudo /etc/init.d/mysql stop

Next, start MySQL in safe mode without grant tables, which store the passwords

sudo mysqld_safe --skip-grant-tables

Now login to MySQL as root with no password. You may need a new terminal since MySQL is probably still running from the above command and you don't want to kill that yet.

mysql -u root

Update the root password

update user set Password=PASSWORD('mypwd') where user='root';
flush privileges;

Logout, kill mysqld_safe with ctrl-c and restart MySQL.

/etc/init.d/mysql start

That should be it.