Home > Database > Mysql Tutorial > body text

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

藏色散人
Release: 2021-11-29 14:19:01
Original
3534 people have browsed it

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
Copy after login

Add a sentence in the [mysqld] section:

skip-grant-tables
Copy after login

Restart the mysql service, service mysql restart

Enter mysql -u root -p Enter and press Enter to enter the mysql database

use mysql;
Copy after login

Lower version modification:

update user set Password = password('LDtianzhe.') where user = 'root';
Copy after login

High version modification:

update user set authentication_string=password('new password') where user = 'root';
Copy after login

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
Copy after login


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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template