1. Unzip the MySQL archive package
Unzip the downloaded MySQL archive into a custom directory, and my unzip directory is:
"D:\Program Files\mysql-5.7.9-win32"
Will unzip the directory under the default file My-default.ini copy one copy, renamed My.ini
Copy the following configuration information to My.ini save
#如果没有my-default.ini, you can create your own my.ini or get it from somewhere else.
#########################################################
[Client]
port=3306
Default-character-set=utf8
[Mysqld]
port=3306
Character_set_server=utf8
#解压目录
Basedir=d:\program Files\mysql-5.7.9-win32
#解压目录下data目录
Datadir=d:\program Files\mysql-5.7.9-win32\data
Sql_mode=no_engine_substitution,strict_trans_tables
[Winmysqladmin]
D:\Program Files\mysql-5.7.9-win32\bin\mysqld.exe
#########################################################
2. Add Environment variables
The operation is as follows:
1) Right-click My Computer, properties, advanced system settings (advanced), environment variables
Click the New button under System variables
Input variable name: mysql_home
Input variable value: D:\Program files\mysql-5.7.9-win32
#即为mysql的自定义解压目录.
2) Select path in the system variable
Click the Edit button
Add a variable value to the value of a variable:%mysql_home%\bin
Note that this variable is appended to the value of the original variable, separated from it, and cannot be removed from the original variable value.
3.
1) from the console into the bin directory under the MySQL decompression directory:
2) Enter the Service installation command:
1. Mysqld--console
2. Mysqld--initialize
3. Mysqld Install
A successful installation will prompt the service to install successfully.
#注: #执行这几步 Because there is no Data folder in MySQL5.7.9, you need to use these commands to generate the Data folder
#移除服务命令为: Mysqld Remove
4. Start the MySQL service
Method One:
The Start service command is: net start MySQL
Method Two:
Open the Administration Tools service and locate the MySQL service.
Start the service by right-clicking to start or by tapping on the left-hand boot directly.
5. Change the password of the root account
1. Modify the MySQL configuration file (My.ini) and add a line under [Mysqld] Skip-grant-tables
2. After the MySQL restart, you can enter directly with Mysql-u root-p (the password is empty at this time)
3. mysql> Update Mysql.user set Authentication_string=password (' 123qaz ') where user= ' root ' and Host = ' localhost ';
4. mysql> flush Privileges;
5. Mysql> quit;
6. Restore the/etc/my.cnf file (delete the Skip-grant-tables line) and restart MySQL
7. This time you can use Mysql-u root-p ' 123qaz ' to enter the
8. Mysql>set PASSWORD = PASSWORD (' 123456 '); Set a new password