1. Download the installation package
https://dev.mysql.com/downloads/mysql/
2. Unzip the MySQL archive package
After the download is done, unzip it and put it in the directory you want to install, for example: D:\ruanjian\mysql-5.7.17-winx64
3. Create and modify the configuration file My.ini
Create a new My.ini configuration file, the original My-default.ini profile is just a template, do not change it inside.
The contents of My.ini are as follows:
Mysql]default-character-set=utf8[mysqld]port = 3306basedir=d:\ruanjian\mysql-5.7.17-winx64datadir=d:\ruanjian\ Mysql-5.7.17-winx64\datamax_connections=200character-set-server=utf8default-storage-engine=innodbexplicit_ Defaults_for_timestamp=true
Default-character-set #客户端默认字符集
Basedir #安装目录
DataDir #数据库的数据的存放目录
Max_connections #允许最大连接数
Character-set-server #服务端使用的字符集
Default-storage-engine=innodb #创建新表时将使用的默认存储引擎
Explicit_defaults_for_timestamp=true #从MySQL5.6, the default behavior of timestamp is deprecated. So add this line to avoid warning.
4. Create a new empty Data folder under the installation path.
5. Add Environment variables
5.1 "New" A variable named "Mysql_home" in the system environment variable. Variable value: "D:\mysql\mysql-5.7.17-winx64"
5.2 Edit the existing environment variable "Path" and Add "%mysql_home%\bin" at the end.
6. Run cmd as administrator, enter the bin directory, and execute the mysqld--initialize-insecure--user=mysql command. Without this step, the service cannot be started after the installation is complete.
7. Install MySQL
Still under the bin directory of the Administrator cmd window, perform the mysqld install command installation. When you are finished, you will be prompted to install successfully.
8. Start
Still under the bin directory of the Administrator cmd window, execute the net start mysqld command to start the MySQL service.
9. Login
In the normal cmd window, go to the bin directory, execute mysql-u root-p command, default no password, enter
10. Modify Login Password
Alter user ' root ' @ ' localhost ' identified by ' new password ';
Installation and configuration of mysql_5.7.17