One, download Mysql-5.7.22-winx64.zip compressed files from the official website, extract to the custom directory.
Second, add the bin directory under the MySQL installation directory to the system PATH environment variable.
Third, configure the My.ini file, placed in the MySQL installation directory. The contents of the file are as follows:
[client]port=3306[mysqld]basedir=d://programfiles//mysql-5.7.22-winx64datadir=d://programfiles// Mysql-5.7.22-winx64//dataport=3306character-set-server=utf8[mysql]default-character-set=utf8
Description: Basedir is the MySQL installation directory, datadir the location for the database file, both paths must exist.
Iv. implementing MySQL--install MySQL
Description: This command creates a service named MySQL, service name customization if you need to remove the service, you can delete it by mysqld--remove MySQL or sc delete mysql.
V. Execute initialization command
Mysqld--initialize--console
or mysqld--initialize-insecure.
Description: The difference between the two is:
The former automatically randomly generates the password for the root admin account,--console the output of the command to the console (in order to view the password)
The latter will use the default empty string as the password.
Vi. start the MySQL service
Command line execution net start MySQL
Close service net stop MySQL
Where MySQL is the service name of the above customization;
Vii. Modifying a custom password
Execute command mysql-u root-p (if the password is empty, you can also use mysql-u root--skip-password)
And then enter the password to successfully connect MySQL;
Three ways to change your password:
1. Alter user ' root ' @ ' localhost ' identified by ' new_password ';
2. Set password for [email protected] = password (' new_password ');
3, use MySQL;
Update user set Authentication_string=password (' New_password ') where user= ' root ';
Flush privileges;
Viii. Other Notes
In the execution of Mysqld--initialize, if the data folder does not exist, the data folder already has the old data, will be an error.
Mysql5.7 Windows free install version initialization configuration