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

2. Installation procedure

  1. You will get a ZIP installation file after downloading it
  2. Decompression path had better not have Chinese and space
  3. Here I unzip toD: \ mysql5.7 \Under the directory [according to their own situation to specify the directory, as far as possible to choose a large disk space]
  4. Add environment variables: Computer – Properties – Advanced System Settings – Environment variables, add mysql installation directory to Path environment variable (usually select system variable)\binDirectory.
  5. inD: \ mysql5.7 \Create under directorymy.iniFiles, 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
  1. Open CMD as administrator (Click Start -> select the directory starting with W to find CMD -> right-click to run CMD as administrator) and switch toD: \ mysql5.7 \ binIn the directory, runmysqld -install

  2. Initialize the database in the bin directory:
mysqld --initialize-insecure --user=mysql
Copy the code
  • If executed successfully, the command is generateddatadirectory
  1. Start mysql service:net start mysqlStop mysql service directiveNet stop mysql 】, if successful:

  2. Enter the mysql management terminal:mysql -u root -pThe password of the root user is empty.
  3. 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
  1. Modify themy.ini, enter again will conduct permission verification. So comment it out:
# skip-grant-tables    
Copy the code
  1. 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.
  1. Enter the correct user name and password to log in to Mysql.
mysql -u root -p
Copy the code