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

What if I forget my mysql password?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following is mainly to bring you forget the mysql password how to do, I hope that these words can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

Centos system

1] mysql5.6.x environment

Centos6.x shuts down mysql

# / etc/init.d/mysql stop

Centos7.x shuts down mysql

# systemctl stop mysqld

# mysqld_safe-user=mysql-skip-grant-tables-skip-networking &

# mysql-u root mysql

Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'

Mysql > FLUSH PRIVILEGES

Mysql > quit

# / etc/init.d/mysql restart

# mysql-uroot-p

Enter password:

Mysql >

2] mysql5.7.x environment

# vim / etc/my.cnf

[mysqld]

Skip-grant-tables

: wq! # Save exit

/ / log in to the database

# mysql-uroot-p

> UPDATE user SET Password=PASSWORD ("userpasswd") where user= "username"

> flush privileges

> quit

/ / comment out the skip-grant-tables line of / etc/my.cnf

/ / restart the service

# systemctl restrt mysqld

At this point, you can log in successfully!

For the above about how to forget the mysql password, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

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

Database

Wechat

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

12
Report