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

Mysql5.7 forgot how to change the root password

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

Share

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

The main purpose of this article is to tell you briefly how to change mysql5.7 's forgotten root password. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope that mysql5.7 forgets how to change your root password. This article can bring you some practical help.

1. Stop the mysql service

/ etc/init.d/mysqld stop

(permanent address of this article: http://woymk.blog.51cto.com/10000269/1916742)

Restart the service

/ usr/local/mysql/bin/mysqld_safe-skip-grant-tables-skip-networking&

Note:-- the skip-networking parameter can block remote client connections and increase security

Or

Vi / etc/my.cnf

Add the following two lines in [mysqld]

[mysqld]

Skip-grant-tables

Skip-networking

Restart the service after saving

/ etc/init.d/mysqld start

After changing the password, you must remember to change it back.

two。 Modify the password

/ usr/local/mysql/bin/mysql-uroot

Mysql > FLUSH PRIVILEGES

MySQL 5.7.6 and later do this:

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass'

MySQL 5.7.5 and previous versions perform this:

Mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' MyNewPass')

Then quit mysql

Mysql > quit

Note that if ALTER USER execution fails, try the following command:

UPDATE mysql.user SET authentication_string = PASSWORD ('MyNewPass')

WHERE User = 'root' AND Host =' localhost'

FLUSH PRIVILEGES

3. Restart the service

/ etc/init.d/mysqld restart

/ usr/local/mysql/bin/mysql-uroot-p

At this point, you can log in with the new password you just changed.

Mysql5.7 forgot how to change the root password to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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