First, preparation

MySQL > download

Pan.baidu.com/s/1LqCp6l9E… Extraction code: WBCH

Two, installation environment

  • Windows version: Windows 10 Professional 64bit
  • MySQL 5.7.26

Three, installation process

1. Decompress and configure environment variables
  • 1. Decompress the installation package mysql-5.7.26-winx64.zip to D:\Program Files and rename it to mysql.
  • Configure environment variables for MySQL Server:

2.1. In the System Variables section, look for the PATH environment variable and click Edit if it exists. In the dialog box that pops up, click “New” and enter (D: Program Files MySQL bin for this tutorial).

(In older Versions of Windows, variable values ended with a semicolon; Separate and add)

; D:\Program Files\MySQL\binCopy the code
  • 3. Register the MySQL service

3.1. Win +R Enter CMD to enter the command prompt

3.2 Switch to disk D and find the installation path: D:\Program Files\MySQL\bin

3.3 Run the mysqld-install command to register the MySQL service

Mysqld install is used to install.\mysqld

  • Create a file named my.ini under D:\Program Files\MySQL
[mysqld]
Set port 3306
port=3306
Set mysql installation directory
basedir=D:\Program Files\MySQL
Mysql > select * from 'mysql'
datadir=D:\Program Files\MySQL\Data
# Maximum number of connections allowed
max_connections=200
The number of connection failures allowed. This is to prevent someone from the host from trying to attack the database system
max_connect_errors=10
The default character set used by the server is UTF8
character-set-server=utf8
The default storage engine to use when creating new tables
default-storage-engine=INNODB
The mysql_native_password plugin is used by default
default_authentication_plugin=mysql_native_password
[mysql]
Mysql client default character set
default-character-set=utf8
[client]
Set the default port used by mysql client to connect to server
port=3306
default-character-set=utf8
Copy the code
Ini file. The best way to do this is to create a new text file, put the above code in the text file, and modify the new text file with the suffix my.ini

In command prompt, run

 mysqld --initialize 
Copy the code

If the command is not executed successfully, enter the value

 .\mysqld --initialize 
Copy the code
  • 5. Configure the MySQL root account

5.1 Run mysqld –skip-grant-tables to enable MySQL Server without password

5.2 Open a new Command prompt and run mysql -u root to log in to the mysql Server.

5.3 Executing Flush PRIVILEGES; Refresh permission.

Grant all PRIVILEGES on. To root@’localhost’ IDENTIFIED by “Grant all PRIVILEGES on.

5.5 Executing Flush PRIVILEGES; Updated the password of the root user.

5.6 Running exit to Exit the MySQL database

End mysqld.exe manually in task Manager

At the command prompt, run net start mysql to restart the mysql Server. Then run mysql -u root -p to log in to the mysql Server.

2. Test the connection using Navicat Premium 12

Host: localhost

Port: 3306

User name: root

Password: The password you set