Reference: Win 10 installing MySQL 5.7
Website: http://blog.sina.com.cn/s/blog_5f39af320102wbk0.html
This article refers to the tutorial on the URL above, thanks to the author for sharing.
I installed the decompression version, because the installation version is not 64-bit, and the installation version is automatically installed, saving a part of the configuration operation,
Anyway is learning, on their own to install the decompression version of the 64-bit.
I'll explain the steps below:
1, download, to MySQL official website: http://dev.mysql.com/
Click Downloads=>community=>mysql Community Server
The selected version starts the download.
2. Unpack the installation package
Unzip the downloaded installation package, put it on your computer path, I placed the E:\mysql
3. Configuring the My.ini File
After extracting the root directory, there is a My-default.ini file, which is the official profile sample version,
We copy this file in the same directory, the name to My.ini (the encoding format must be ANSI format, other UTF-8 etc. cannot be used)
Use TXT to open the editor, the original description content empty, modified as follows: (again, this is copied from the reference site)
Because there is no. ini file after decompression create a new My.ini file in this directory
[MySQL]
#设置mysql客户端默认字符集
Default-character-set=utf8
[Mysqld]
#设置3306端口
Port = 3306
#设置mysql的安装目录
Where these two paths are the local paths of their own MySQL
basedir=e:\mysql5.7
#设置mysql数据库的数据的存放目录
Datadir=e:\mysql5.7\data//
#允许最大连接数
max_connections=200
#服务端使用的字符集默认为8比特编码的latin1字符集
Character-set-server=utf8
#创建新表时将使用的默认存储引擎
Explicit_defaults_for_timestamp=true
Default-storage-engine=innodb
After modifying, save exit.
4. Install MySQL
Open the cmd window in the administrator's body , to C:\windows\system32\cmd.exe find the CMD program, (The following all CMD command operation, preferably open as Administrator)
Win10 's administrator's cmd log in
by E:
CD MySQL
CD bin
These three steps go into the MySQL bin directory,
Input command: mysqld Install
After waiting for the prompt to install successfully,
Input command: mysqld--initialize, this step is used to initialize the data directory, the official compression package decompression and no Data folder, after running the command, automatically generate the data folder under the root directory
Finally, enter the command: net start MySQL, start the service.
5. Set the root administrator password
The new version of the Mysql,root user's password can not be empty, at this time, our root is no password, so we need to set.
Win+r, enter services.msc, open the service, find the MySQL service, close it.
Then open cmd and enter the command:
E:
CD MySQL
CD bin
Mysqld--defaults-file= "E:\mysql\my.ini"--console--skip-grant-tables
One other way is to find your own My.ini file add a line under [Mysqld] Skip-grant-tables
This is the safe mode of turning on MySQL. (This cmd does not close)
In addition, open a CMD and enter the command:
E:
CD MySQL
CD bin
Mysql-u root-p
At this point, cmd displays the Enter password:
Hit the enter key directly to successfully enter MySQL
Enter the SQL statement as follows:
Use MySQL; Show Database changed
Update user set Authentication_string=password ("123") where user= "root"; Display: Query ok,1 rows Affected (0.01 sec) rows matched:1 changed:1 warnings:1
Flush privileges; Display: Query ok,0 rows Affected (0.00 sec)
Quit
Complete so that the root user's password is set to 123.
Finally, in order to facilitate the start of MySQL later, configure environment variables
Path append:; E:\mysql\bin;
Complete, the next way to run MySQL is to open cmd, enter the command:
Mysql-u root-p
123
You can do it.
6, after the first run, set common parameters:
1) After login, it is necessary to set the root user's password in normal mode, enter: Set Password=password (' 123 ');
2) Open the full permissions of the root operation database:
Use MySQL;
Show tables;
Select Host,user from user;
Update user set host= '% ' where user= ' root ';
Quit
net stop MySQL (note service names are case sensitive)
net start MySQL (note service names are case sensitive)
Complete.
MySQL is fully installed and ready to use.
TIP: If the "MySQL service is starting or stopping, please try again later" or "the MySQL service is starting, the mSQL service cannot start" is resolved by the Task Manager to end the mysqld process.
TIP: Summarize the installation steps for MySQL
The free install version (which can actually be used with two free installs), the general correct installation sequence is as follows:
Mysqld Install (This command is used for installing the service, followed by the service name)
Mysqld--initialize (automatic generation of root users with random passwords)
Mysqld–initialize-insecure (automatic generation of root users without passwords)
net start MySQL (start service, with service name)
WIN10 install MySQL decompression version installation steps