Networking HowTos
Networking HowTos

Change the MySQL root password

April 15, 2012 Database, MySQL

Ensuring you have a secure, and hard to guess MySQL root password is critical on production servers. If you don’t currently have a strong MySQL root password, please update it using the details below. Likewise, if you think someone may know the password, who shouldn’t, change the password immediately.
Run the following SQL statement on the MySQL server to change the root users password:
Obviously change ‘1234’ with the password you would like to set. Make sure you set a strong password.

UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';

If you want to include \ or ‘ characters in the password, they will need to be escaped.
Replace ‘root’ with the name of another MySQL user account if you wish to change their password instead.
After making changes to permissions/user accounts, make sure you flush the provilege tables using the following command:

FLUSH PRIVILEGES;

You Might Also Like