First, installation
- Download MySQL
Zip version MySQL does not need to run the executable file, unzip it, download the zip version of MySQL
MSI version MySQL double-click File to install, relatively simple, this article does not describe this version of the installation
- Configuring Environment variables
Open environment Variable Configuration page (Winserver server environment variable location: Server Manager, local server, computer name, advanced environment variable), add the MySQL bin file path after the system variable path, for example:; C:\mysql-5.7.17-winx64\bin
- Configure MySQL
MySQL configuration file My-default.ini in the project root directory, directly modified, of course, the new configuration file can also, such as: My.ini
The configuration file is modified in the following way:
Basedir = C:\mysql-5.7.17-winx64 (mysql root directory)
DataDir = C:\mysql-5.7.17-winx64\data (MySQL database storage directory)
Port = 3306 (MySQL open port, default 3306, modifiable)
- start MySQL
a. Start cmd
B. Toggle disk, command: C:
C. Enter the bin directory of MySQL, command: cd c:\mysql-5.7.17-winx64\ Bin
D. Install the MySQL service, command: Mysqld-install, return Result: Service successfully installed. Shortcut key win+r, perform services.msc view service to see if the MySQL service has occurred
E. Initialize MySQL and specify superuser password, command: mysqld--initialize-insecure--user=mysql
F. Start the MySQL service, command: net start mysql
- Problems and Solutions
A. net start MySQL start MySQL service, startup failure, return results: system error 2 occurred, the system cannot find the specified file
perform services.msc view service MySQL, on the service right-click Properties, general, to see if the executable path is correct, if not correct, may be started MySQL when the drive letter is caused, execute command: Mysqld-remove, Remove the MySQL service and reinstall
B. net start MySQL start MySQL service, startup failure, return results: TheMySQL service does not start, the service does not report any errors, please type NET HELPMSG * * * For more help
Find a file with a suffix of. Err in the previously configured DataDir path (if the path specified does not exist, the. err file is not found, the path should be created first, and then the service is started), and this file logs the MySQL error log. If the error recorded in the log is: [ERROR] Can ' t open the MySQL. Please run Mysql_upgrade to create it, first empty the files in DataDir and then execute the command initialization: mysqld--initialize-insecure--user=mysql
Second, login user management and password modification
- Log in to MySQL
A. Start cmd
B. Login, command: Mysql-u root-p, because no password is specified when the Superuser is initialized (the initial password can be randomly generated), so the default password is empty, enter the password step directly, see Welcome message: Welcome to the MySQL monitor
- To modify the root user password
A. View all initial databases, where the MySQL library is the library just initialized with user login information
B. Select database, command: use MySQL;
C. View user's existing user and password, Note: mysql5.7 User password field authentication_string,5.7 previously password
D. Change the root password
Update user Set authentication_string = password (' 123456 ') where user = ' root ';(updating the username root password is 123456)
flush privileges; (Refresh the System permissions related table, note: If you do not execute the command only modifies the authentication_string in the user table, the login password will not change )
Third, open remote access
- Querying user Host
Host is localhost to allow only local logons, host for IP to allow only specified IP user logon, host% to allow any IP users to log on
- New user to allow remote link to MySQL database
Grant all on * * to [e-mail protected] '% ' identified by ' 123456 ' with GRANT option;
Flush privileges;
Create a user with a login named SA with a password of 123456 for any IP access (% available with specific IP overrides)
Iv. Reference Links
MySQL 5.6 for Windows uncompressed version configuration installation
What does flush privileges mean?
Configure MySQL to allow remote connection methods
Winserver2012 MySQL 5.7 decompression version (Zip) configuration installation