The most commonly used version is 5.7, and the latest version 8.0 is also widely used.
The article directories
- 1. Download
- 2. Installation procedure
1. Download
- Mysql’s official website:Dev.mysql.com/downloads/m…
- Mysql 5.7 has decompressed installation packages and.exe installation packages. Compression installation is recommended. (because the.exe mode seems to be unable to select the installation path, the default C disk installation).
- Special instructions:
If you install Mysql, you get an error or want to try again
sc delete mysql
Mysql > Install mysql
2. Installation procedure
- You will get a ZIP installation file after downloading it
- Decompression path had better not have Chinese and space
- Here I unzip to
D: \ mysql5.7 \
Under the directory [according to their own situation to specify the directory, as far as possible to choose a large disk space] - Add environment variables: Computer – Properties – Advanced System Settings – Environment variables, add mysql installation directory to Path environment variable (usually select system variable)
\bin
Directory. - in
D: \ mysql5.7 \
Create under directorymy.ini
Files, we need to create our own. Write to the following file:
[client] port=3306 default-character-set=utf8 [mysqld] # basedir=D:\mysql5.7\ # Datadir =D:\mysql5.7\data\ port=3306 CHARACTER_set_server =utf8 # skip skip-grant-tablesCopy the code
- Open CMD as administrator (Click Start -> select the directory starting with W to find CMD -> right-click to run CMD as administrator) and switch to
D: \ mysql5.7 \ bin
In the directory, runmysqld -install
- Initialize the database in the bin directory:
mysqld --initialize-insecure --user=mysql
Copy the code
- If executed successfully, the command is generated
data
directory
- Start mysql service:
net start mysql
Stop mysql service directiveNet stop mysql 】
, if successful:
- Enter the mysql management terminal:
mysql -u root -p
The password of the root user is empty. - Change the password of user root
use mysql;
update user set authentication_string=password('xdr') where user='root' and Host='localhost';
Copy the code
- Change the password of user root to XDR
- Note: a semicolon must be followed, and press enter to execute the command
- Perform:
flush privileges;
Refresh the permissions - Exit:
quit
- Modify the
my.ini
, enter again will conduct permission verification. So comment it out:
# skip-grant-tables
Copy the code
- Restart mysql
net stop mysql
net start mysql
Copy the code
- Note: This command needs to exit mysql (run stop and then start) and be executed under Dos.
- Enter the correct user name and password to log in to Mysql.
mysql -u root -p
Copy the code