Install and configure the Mysql zip package on Windows
Environment: 64-bit Windows 7 system running mysql-5.7.16-winx64.zip
1. download the required mysql zip package from the mysql official website. For example, mysql-5.7.16-winx64.zip is downloaded;
2. Decompress to local disk (such as D disk), decompress the folder for mysql-5.7.16-winx64, rename to mysql-5.7.16;
3. Enter the mysql-5.7.16 folder, the default configuration file displayed is my-default.ini, there are fewer configuration items in the configuration file, I re-create a configuration file my. ini;
4. Double-click my. ini and enter the configuration content:
[Client]
Port = 3306
Default-character-set = utf8
[Mysqld]
Port = 3306
Character_set_server = utf8
Basedir = D: \ mysql-5.7.16
Datadir = D: \ mysql-5.7.16 \ data
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
Save the configuration file;
5. Set Windows environment variables: Right-click "computer" on the desktop, choose "properties"> "Advanced System settings"> "environment variables"> "system variables"> "Path", and add Path D at the end of the variable value box: \ mysql-5.7.16 \ bin, save;
6. In Windows running, Enter cmd, enter the command line window, enter D:, press enter to enter D disk, then enter cd mysql-5.7.16 \ bin, press enter to enter the bin directory, enter the following three commands in sequence;
A. Command: mysqld -- initialize initializes mysql and generates files in data;
B. Command: install mysql
C. Command: net start mysql to start mysql Service
Note: Other commands: mysqld-remove to uninstall mysql; net stop mysql to stop mysql service;
Difference between mysql and mysqld: mysql is a client program, and mysqld is a server program;
7. After configuring the preceding settings, you can log on to mysql:
A. Because the root password is not set during the First Login, an error will be reported during logon. add skip-grant-tables to the ini file, save the settings, and restart the mysql service. In cmd, enter: net stop mysql; net start mysql; mysql-uroot-p, after you press enter, you can log on directly;
B. Set the root password:
① Enter the mysql database: use mysql;
② Set password: update user set authentication_string = password ('xxx') where user = 'root' and Host = 'localhost'; (version 5.7)
Update user set password = password ("xxx") where user = "root"; (Version 5.5)
③ Exit the database: exit (or quit)
④ After the password is changed, enter my. ini, comment out skip-grant-tables, and save the settings;
⑤ Restart the mysql service and log on again;
8. log on to mysql again and enter the command: alter user 'root' @ 'localhost' identified by 'xxx ';
Exit: quit
So far, the installation and configuration are complete! You can start using mysql.