1、 MySQL installation
Download community version on official website
Unzip to Disk C: C:\mysql-5.7.21-winx64
Run the command line as an administrator and enter the directory C:\mysql-5.7.21-winx64\bin
Registration service:C:\mysql-5.7.21-winx64\bin>mysqld install mysql5.7.21
Initialize database: C:\mysql-5.7.21-winx64\bin>mysqld --initialize
Startup database:C:\mysql-5.7.21-winx64\bin>net start mysql5.7.21
Sign database:C:\mysql-5.7.21-winx64\bin>mysql -u root -p
Note: the login password can be found in the *. err
file of MySQL installation directory, for example, the red character: 2018-01-17T09:26:11.260249Z 1 [Note] A temporary password is generated for root@localhost: _=(H,?pX.7yZ
- update root user password:C:\mysql-5.7.21-winx64\bin>mysqladmin -u root -p _=(H,?pX.7yZ password 1234
2、 MySQL configuration
Create C:\mysql-5.7.21-winx64\my.ini
by yourself. The contents of the file are as follows:
[mysqld]
#Set 3306 port
port = 3306
#Set the installation directory of MySQL
basedir=C:\mysql-5.7.21-winx64
#Set the storage directory of MySQL database data
datadir=C:\mysql-5.7.21-winx64\data
#Maximum connections allowed
max_connections=200
#The character set used by the server defaults to the 8-bit Latin1 character set
character-set-server=utf8
#Default storage engine to use when creating new tables
default-storage-engine=INNODB
#Set to strict mode
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
#Set MySQL client default character set
default-character-set=utf8