mysql5.7.18 installation password recovery,

Mysql5.7.18zip version installation

Windows 10 Education Edition system to install mysql

1. Download

https://dev.mysql.com/downloads/mysql/

 



After decompression, there are 5 folders and two files in your own installation location, such as my D:\Java\ mysql57

 

2. Configure environment variables

 

 

1 ) Create a new variable named   MYSQL_HOME   

The variable value is written to the location where the decompressed file is placed. I put it under the D:\Java\mysql57 disk.

 

2 ) Add path variable value

 

 

Click  New  and fill in the variable value %MYSQL_HOME%\bin   here without adding a ";"   semicolon like the previous win7 system   . Click OK to exit the environment variable configuration.  

 

3. Register windows system service

1 ) Prepare the my.ini file . Note: (it is said) that after decompression in previous versions, there will be my-default.ini or my.ini files in the decompression directory , but after decompression in version v5.7.18 , these files do not exist. Therefore, the my.ini file needs to be created manually . The specific (complete) content of the file is as follows:

[client]

port=3306default-character-set=utf8

[mysqld]

port=3306

character_set_server=utf8

basedir=%MYSQL_HOME%

datadir=%MYSQL_HOME%\data

[WinMySQLAdmin]%MYSQL_HOME%\bin\mysqld.exe

After editing the my.ini file, put my.ini in the bin directory

 

 

2) run cmd as administrator

 

3) Go to the bin directory of the installation directory:

cd d:\java\mysql57\bin

D:

 

4 ) To install the MySQL database, execute the following command: mysqld.exe -install

Prompt: Service successfully installed. Indicates that the installation was successful

 

 If you want to remove, the command to remove the service is: mysqld remove

 

5) Initialize the mysql data , and create a root user with an empty password , execute the following command: mysqld --initialize-insecure --user=mysql Note: the last parameter --user=mysql can also be added in windows , but in Unix and other systems seem to be very important. After executing the command, after a while, the system will automatically generate the corresponding data directory and automatically create the root user with an empty password . At this time, the initialization is successful , use mysqld --initialize-insecure to generate the data directory, otherwise it will be troublesome if you don’t remember the random password

 

6 ) To start the mysql service , execute the following command: net start mysql After execution, it prompts: MySQL service is starting .. MySQL service has been started successfully.




Note: To log in and use mysql , the service must be started first. the same in the future

7) Change password

Please back up  the data folder before changing the password.

After the service is started, because the root user just created has an empty password, it is necessary to set the password first. The following command can be executed: mysqladmin -u root -p password Enter the new password here Enter password: Enter the old password here After executing the above two commands, as long as the old password entered after Enter password: is correct, the root user Even if the new password is set successfully. After that, if you want to log in to the root user, you need to use the new password. Note: The root user just created has an empty password. Therefore, when modifying the password of the root user for the first time , you do not need to enter any password after Enter password:, just press Enter



  

I can't do this, so I remade the password again.

4. Password remake.

Then my password becomes: "I was supposed to enter the password". The password characters seem to be wrong, even if you enter "the password should have been entered", it won't work. Fortunately, I have backed up all the files in the data\mysql folder before, as follows:

 

I tried it, and it seems that it is probably the following files.

 

 

 

I use another software to assist, so I can’t enter the Chinese character password, as shown in the picture below: It prompts that the password is incorrect and the connection cannot be made .

 

cmd can input Chinese character password:

 

Copy the " password that was supposed to be entered ", and click it with the mouse under cmd , and you cannot use shortcut keys.

 

It is strongly recommended to install the mysql folder under the data folder of the backup backup . in case for need.

There is another way: stop the mysql service. Then go to the background to close the mysql process, enter mysqld remove  to uninstall the mysql service, then delete the data folder in the installation directory , and then start again from the fourth small step of the third big step .

Guess you like

Origin blog.csdn.net/u014304688/article/details/73064947
Recommended