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 MySQL5.7 forgets the root password under Windows 8.1?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article will explain in detail how MySQL5.7 forgets the root password under Windows 8.1. the editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

[problem solving process]

First, skip the permission review of MySQL and enter MySQL

First, find the my.ini configuration file for MySQL.

Then, open the file, under mysqld, and add a line of code skip-grant-tables to skip permission auditing.

A very important step: win+R type services.msc, find the mysql service, and restart the service.

I suspect that this step was not performed correctly when I did it before. (also, here I have some questions about how I have two MySQL services, one MySQL, one MySQL57,MySQL property without a configuration file, and MySQL57 does. )

Reset the password in the mysql.user table

First, cmd enters the DOS window, type MySQL, and enter enter. You can successfully enter MySQL without a password. I couldn't even achieve this step before, so when I successfully entered the MySQL, not to mention how happy I was.

Then, let's see what's in the mysql.user table. Select user,host,authentication_string from mysql.user

(Tips: at first, I queried password and found that this field did not exist. Later, I found out that MySQL5.7 had replaced the password field with authentication_string.)

= =

Here, take a look at host.

The Host column specifies the IP range used to allow users to log in.

Like user=root Host=192.168.21.1. This means that root users can only access it through the client of 192.168.21.1. While% is a wildcard, if Host=192.168.1.%, then it means that as long as the IP address is prefixed with "192.168.21." The client of can connect. If Host=%, indicates that all IP have connection permissions. So when you want to open a remote connection, most people directly change Host to%, because it's super convenient.

= =

A very important step: let's set up the host and password.

Update mysql.user set host= "%", authentication_string=password ('root') where user='root'

Third, refresh permissions to update the data that has been changed and is in the buffer. Flush privileges

There is also a little doubt: after refresh, you directly enter mysql, there is no way to skip password audit to enter MySQL, but the configuration file clearly has not commented out that sentence skip-grant-tables ah? Will refresh ignore the configuration file you just modified?

Anyway, I annotated the sentence skip-grant-tables in my.ini later.

Use your password to log in!

First, type mysql-u root-p, then enter the password you just set, and you can successfully enter!

Finally, please form a good habit and remember your precious password. :)

About Windows 8.1 MySQL5.7 forgot the root password how to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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