This guide is for Ubuntu, but you should be able to find similar commands on most platforms.
There are many reasons why you might want to change your MySQL root password, but fortunately it's fairly straightforward to do. Just SSH into your server and do the following:
- Stop the MySQL server:
service mysql stop
- Start the mysqld configuration:
sudo mysqld --skip-grant-tables &
- Log in as root:
mysql -u root mysql
- Run the following SQL command to change your password:
UPDATE user SET Password=PASSWORD('YourNewPasswordHere') WHERE User='root'; FLUSH PRIVILEGES; exit;
And that's it! Your root password will be changed.