Home >Database >Mysql Tutorial >What should I do if I forget my password in centos mysql?
centos mysql forgotten password solution: 1. Add "skip-grant-tables" to the [mysqld] section; 2. Restart the mysql service; 3. Enter "mysql -u root -p "; 4. Just change the password through update.
The operating environment of this article: centOS6.8 system, mysql5.5, Dell G3.
centos mysql how to forget the password?
centos system mysql forget the password
After installing mysql, pay attention to adding soft connections
mysql Forgot password operation,
vim /etc/my.cnf
Add a sentence in the [mysqld] section:
skip-grant-tables
Restart the mysql service, service mysql restart
Enter mysql -u root -p Enter and press Enter to enter the mysql database
use mysql;
Lower version modification:
update user set Password = password('LDtianzhe.') where user = 'root';
High version modification:
update user set authentication_string=password('new password') where user = 'root';
Vim /etc/my again. cnf Comment out the restart service added above to enter the database again
If this error occurs:
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
Need to turn off the protected mode
Use the update password again
Exit, comment out skip-grant-tables
Restart the service
Recommended learning: "mysql video tutorial"
The above is the detailed content of What should I do if I forget my password in centos mysql?. For more information, please follow other related articles on the PHP Chinese website!