MySQL version 5.7 and above is different from the previous configuration, here to share with you experience.
Unzip
Unzip the downloaded file to your favorite location, such as my own location is D:\Program files\mysql-5.7.10-winx64
Adding environment variables
Environment variables, high-level system settings, properties, right-click Computers, locate path in the system variable, select Edit, and add the MySQL bin directory at the end of the original value, for example my is D:\Program files\ Mysql-5.7.10-winx64\bin; (note or modify is added with a semicolon)(personal experience: In the path of the user variable to prevent the entire system from being scrambled)
Add a configuration file
Under the MySQL installation directory (for example, my D:\Program files\mysql-5.7.10-winx64), create a new TXT file and name it My.ini (note that the extension is also modified).
(Personal Experience : Copy the My-default.ini directly to the name on the line)
Double-click to open the file and add the following to it:
[Mysqld]
Basedir=d:\program files\mysql-5.7.10-winx64
Datadir=d:\program Files\mysql-5.7.10-winx64\data
Port = 3306
Close after saving
Initializing the database
Open cmd as an administrator to execute the following commands (note that you must open as an administrator or report an error)
Mysqld--initialize--user=mysql--console
A randomly generated initial password appears at the end of the console message (because there are special characters, it's easy to remember, it's best to keep the whole message in Notepad)
(Personal Experience : If not noted, you can also look at the "computer name. Err" file, at the end of the password)
-
Add MySQL to System services
Open cmd as Administrator to execute the following command (note that you must open as an administrator, otherwise error)
(personal experience : My computer goes to the MySQL directory and executes the following command.
Mysqld --install mysql
Net start MySQL
Span style= "color: #ff0000;" > (personal
Successful installation, display "service started successfully"
Start MySQL and change the password
Execute commands in the cmd console mysql-u root-p
Enter the random password that you just recorded after you execute the carriage return
After successful execution, the console displays Mysql>
Input command set password for [email protected] = password (' 123 '); (Note semicolon)
( There is no password field in the user table in the new MySQL database , but the encrypted user password is stored in the authentication_string field )
At this point the root user's password is modified to 123
END