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 shut down MySQL.

2. Start MySQL in Safe Mode Skipping Grant Tables
First, find the mysqld_safe program. You can use the command find / -name "mysqld_safe" 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 to MySQL as Root and Reset Password with New Privileges
Open a new connection and log in to your cloud server

1) First, enter the mysql -u root command 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) 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.