Home >Database >Mysql Tutorial >What should I do if I forget my password in centos mysql?

What should I do if I forget my password in centos mysql?

藏色散人
藏色散人Original
2021-11-29 14:18:543565browse

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.

What should I do if I forget my password in centos mysql?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does mysql in mean?Next article:What does mysql in mean?