1. Stop the MySQL Service
# service mysql stop

If you get an error like “mysql: unrecognized service”,
first locate mysql.server using: find / -name "mysql.server"

Then use the command /usr/local/mysql/share/mysql/mysql.server stop to stop MySQL.

2. Start MySQL in Safe Mode, Skipping Grant Tables
First locate the mysqld_safe program. You can use the find / -name "mysqld_safe" command to locate it; it is usually in the MySQL installation directory.
# find / -name "mysqld_safe"

Start MySQL in safe mode, skipping grant tables
![]()
3. Log in as Root and Reset the Password
Establish a new connection to log in to the cloud server

1) Enter the command mysql -u root to log in to MySQL
2) Then enter update mysql.user set password=PASSWORD('123456789') where User='root'; to update the MySQL password to: 123456789
3) Type quit to exit MySQL
4. Restart the MySQL Service

1) killall mysqld to terminate all MySQL processes
2) service mysql start to start MySQL
3) mysql -u root –p and press Enter. When prompted for a password, enter the MySQL password you just reset.