Reset a MySQL root password

Reset a MySQL root password

The MySQL root password allows the root user to have full access to the MySQL database. You must have (Linux) root or (Windows) Administrator access to the Cloud Server to reset the MySQL root password.

Stop the MySQL service

sudo /etc/init.d/mysql stop

Start MySQL without a password

Run the following command. The ampersand (&) at the end of the command is required.

sudo mysqld_safe —skip-grant-tables &

mysql -uroot

Set a new MySQL root password

use mysql;

update user set authentication_string=PASSWORD(«mynewpassword») where User=’root’;

flush privileges; quit

Stop and start the MySQL service

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysql start