Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS 7.7 solves the problem of password loss of MySQL 5.7 root users installed in yum mode

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Unable to enter the database without entering or entering the wrong root user password:

# mysql-uroot-p

(1) enter directly without entering the root user password:

(2) enter the wrong root user password:

2. Force the termination of the MySQL process:

# yum-y install psmisc

# killall mysqld

# pkill mysqld

# ps-ef | grep mysql

# ss-tunlp | grep 3306

3. Use the mysqld command, add the-- skip-grant-tables parameter, skip the permission table, and start the database:

# mysqld-defaults-file=/etc/my.cnf-user=mysql-skip-grant-tables &

# ps-ef | grep mysql

# ss-tunlp | grep 3306

4. Use the mysql command to directly enter the database, set a new password for root users and refresh permissions:

# mysql

Mysql > use mysql

Mysql > update user set authentication_string=password ('root@1234') where user='root'

Mysql > flush privileges

5. Restart the database:

# killall mysqld

# pkill mysqld

# ps-ef | grep mysql

# ss-tunlp | grep 3306

# systemctl start mysqld

6. Enter the password root@1234 newly set by the root user to enter the database:

# mysql-uroot-p

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report