First, download
Official Download: https://dev.mysql.com/downloads/mysql/
I am here using the mysql-5.7.27 version, download links:
https://pan.baidu.com/s/13KpNeWmGXcjBtZhA2EDIEQ extraction code: p9ca
Second, unzip
Third, create a my.ini file in the root directory
Use Notepad to open my.ini, copy the following parameters basedir and datadir, wanted to change the path of their own installation.
[mysql]
#设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port=3306
#设置mysql的安装目录
basedir=C:\\Program Files\\mysql\\mysql-5.7.27-winx64
#设置mysql数据库的数据的存放目录
datadir=C:\\Program Files\\mysql\\mysql-5.7.27-winx64\\data
#允许最大连接数
max_connections=200
#服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
#创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
Save time, please save as a way to save with "ANSI" encoding.
Fourth, the configuration
Run as administrator mode, open the cmd.exe file, unzip into the mysql directory under the bin directory, followed by executing the following command
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysqld -install
If prompted lost MSVCR120.dll, install VC runtime at the following link:
https://pan.baidu.com/s/1lIQdGLmrnyG15oDUz6Htsw extraction code: ra0g
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysqld --initialize
Initialize the future success will generate data directory, and generates a root user;
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>net start mysql
Start mysql service.
Fifth, login authentication
1, a way
After the service starts successfully, directly enter the following command to set the password,
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysqladmin -u root -p password 新密码
Since the first was logged in as root to use, simply press the Enter key on it. Then enter the following command to verify,
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysql -u root -p
Enter, enter a new set password, verify that you can log in successfully.
2. Second way
Enter the following command to log on directly,
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysql -u root -p
Since the first was logged in as root to use, simply press the Enter key on it. If the login is not successful, resolve as follows ,
Search * .err file in the mysql-extracting directory and open the file as text,
Use random password found, using the root user to log in again, after a successful login, change password,
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>mysql -u root -p &fifiy,%l97U
C:\Program Files\mysql\mysql-5.7.27-winx64\bin>alter user user() identified by “123456”
After the Log, with a new set of password Verify that you can log in successfully.