1. Download and unzip
2. Create a new My.ini file with the following content
[MySQL] # set MySQL client default character set Default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # Set the MySQL installation directory basedir=d:\mysql-5.7.21-winx64# Setting the data storage directory of the MySQL database datadir=d:\mysql-5.7.21-winx64\data # Allow maximum number of connections max_connections=200 # The character set used by the service side defaults to the 8-bit encoded latin1 character set Character-set-server=utf8 # The default storage engine that will be used when creating a new table Default-storage-engine=innodb
3. Run cmd as Administrator, switch to Bin directory
4. Enter Mysqld Install
5. Input: mysqld--initialize-insecure--user=mysql
MySQL will build a data folder, and set up the default database, login user name is root, password is empty
6. Start: net start MySQL
Attention:
After starting the service, if you do not want to switch directories in CMD and want to enter the MySQL statement directly, you need to add the path to the bin directory of the MySQL installation directory into the path variable of the system environment variable.
There is a need to note that when installing the MySQL service, be sure to switch to the MySQL installation directory in the bin directory, regardless of whether you configure environment variables, or if you start the service after installation is still reported error-"A system error 2 system cannot find the specified file." ”
7. Login
Log in/Enter MySQL database
CMD window input: Mysql-u root–p, enter, enter password, then enter.
MySQL Installation and configuration