当前位置:网站首页>[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti

[solved] after referring to the local MySQL and forgetting the password, [server] --initialize specified but the data directory has files in it Aborti

2022-07-19 02:35:00 Tamarind_

Local installation mysql after , Forgot the password , So I found the following article :

https://www.jb51.net/article/215881.htm

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)_huang6ing The blog of -CSDN Blog ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061) There are many reasons for this problem , Each reason is different , Write out my solution, hoping to help you ; One 、 Location problem 1、 At the beginning of the menu search “ Computer management ”, Then click to open it .2、 Found under service “MySQL”, And then start the service ( After successful startup, the status is “ Running ”), Right click to refresh after starting the service . At this time ...https://blog.csdn.net/huang6ing/article/details/103821495


The above two connections are used in combination , It can be completely solved under normal circumstances .

But to perform mysqld --initialize --user=mysql --console when , Normally, it should initialize mysql The default password for , But I encountered the following situation :

D:\workSoftWare\anzhuang\mysql-8.0.21-winx64\bin>mysqld --initialize --user=mysql --console
2022-05-07T07:55:57.563900Z 0 [System] [MY-013169] [Server] D:\workSoftWare\anzhuang\mysql-8.0.21-winx64\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 20852
2022-05-07T07:55:57.565525Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-05-07T07:55:57.565534Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:\workSoftWare\anzhuang\mysql-8.0.21-winx64\data\ is unusable. You can remove all files that the server added to it.
2022-05-07T07:55:57.566776Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-05-07T07:55:57.567065Z 0 [System] [MY-010910] [Server] D:\workSoftWare\anzhuang\mysql-8.0.21-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.21)  MySQL Community Server - GPL.

【 Solution 】

Obviously wrong . So I checked the wrong content , Because

①mysql In the installation package ,my.ini Files to be placed in bin Under the folder ;

② May be because data I created the folder manually , There was an error in the file in the initial installation ;

The first time it was installed , A certain Don't create it yourself data Folder ,data Folder is execution install Created automatically when ! So I deleted data Folder ( You can also try deleting only data Contents of the folder ).

Here are the current installation files

 

  When you execute it again , Successfully initialized

  Log in to mysql Yes, you can log in ~


  After the initialization , Need to change password , Otherwise, the following errors will occur

Change user password

alter user 'root'@'localhost' identified by 'youpassword'; 

Refresh the permissions

flush privileges;

After modification , You can use the new password to execute

 

原网站

版权声明
本文为[Tamarind_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170008556347.html