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

How to restore the deleted Mysql8.0.17 Root account and password under Window

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

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to restore deleted Mysql8.0.17 Root accounts and passwords under Window. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

How to quickly restore root:

1. Turn off the mysql service: type services.msc with win+ R key, locate the mysql service, and click stop

two。 Delete the data folder and its files: enter the mysql folder, find the data folder, and delete

3. Initialize mysql: enter services.msc again to run the mysql service; enter the cmd window into the mysql\ bin file path, and run mysqld-- initialize-- console. The result is similar to the following:

2019-08-07T02:08:11.300849Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is

Deprecated. Please use-explicit_defaults_for_timestamp server option (see doc

Umentation for more details).

2019-08-07T02:08:11.724874Z 0 [Warning] InnoDB: New log files created, LSN=45790

2019-08-07T02:08:12.024891Z 0 [Warning] InnoDB: Creating foreign key constraint

System tables.

2019-08-07T02:08:12.056893Z 0 [Warning] No existing UUID has been found, so we a

Ssume that this is the first time that this server has been started. Generating

A new UUID: 35611a71-b8b8-11e9-8e24-28d24409926b.

2019-08-07T02:08:12.064893Z 0 [Warning] Gtid table is not ready to be used. Tabl

E 'mysql.gtid_executed' cannot be opened.

2019-08-07T02:08:12.076894Z 1 [Note] A temporary password is generated for root@

Localhost: QTpg4Y!sh:dk

Note that there is a temporarily generated root account password in the bold statement.

4.cmd run mysql: type the mysql-u root-p+root password; note: P is the abbreviation of password, according to the above example, you should type: mysql-u root-pQTpg4YYroomshmysql DK-p and the password must be connected together to be valid, with no spaces in between

5. Change the temporary root password: run the sql statement: alter user root@localhost identified by 'root password'; Note: the password should be included in English single quotes'', otherwise invalid error will be reported at the end of the semicolon; also be written.

6. Whether the query is successful: run the sql statement: select user from mysql.user; successfully displays the root account

Note: although this method is fast and effective, it will delete all database files, that is, the database in the data folder. Other attempts to add skip-grant-tables to bypass login authentication are not valid for version 8.0.17.

Thank you for reading! This is the end of the article on "how to restore deleted Mysql8.0.17 Root accounts and passwords under Window". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out 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