Install and configure MySQL5.7, and mysql5.7

Source: Internet
Author: User

Install and configure MySQL5.7, and mysql5.7

1. Download MySQL

1. log onto the MySQL official website to download the ZIP package for 64-bit systems (https://dev.mysql.com/downloads/mysql)

Ii. Unzip the installation package

Decompress the downloaded ZIP package to any folder. (C: \ mysql5.7)

3. modify the configuration file

Rename the my-default.ini file under the unzipped folder directory to my. ini.

Open and clear the content in the text editor.

Add content (refer to the Internet ):

[Mysql] # set the default character set of the mysql client default-character-set = utf8 [mysqld] # set port 3306 to port 3306 # set the mysql installation directory basedir = C: \ mysql5.7 # Set the data storage directory of the mysql database datadir = C: \ mysql5.7 \ data # maximum number of connections max_connections = 200 # The default character set used by the server is the 8-bit latin1 character set character-set-server = utf8 # default storage used when creating a new table engine default-storage-engine = INNODB

Note:

Basedir and datadir are replaced by their actual paths.

The unzipped folder directory of MySQL5.7 does not contain the data folder. You don't have to worry about it. You will use the command to initialize and create it later. Manual creation is not required here.

Save the modification and exit.

Iv. Configure Environment Variables

Add C: \ mysql5.7 \ bin in the Path environment variable (replace the actual bin directory Path here)

Note: It is separated from the previous environment variables;

V. Install MySQL

Run the cmd window as an administrator.

Switch to the C:/mysql5.7/bin directory

Enter the following commands in sequence:

1. mysqld install. Wait for the prompt that the installation is successful.

2. mysqld -- initialize the data directory

3. net start mysql startup Service

6. Modify the password of the root user 

After completing the preceding five steps, run mysql-u root-p. Because the root user does not have a password by default, press enter to enter.

ERROR message: ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)

This is because the root user of mysql has not set a password. We need to temporarily ignore the permission to set the password of the root user.

The procedure is as follows:

Add a line of statement skip_grant_tables under the [mysqld] entry in the configuration file my. ini.

Save and exit, and restart the MySQL service. It does not work if you do not restart the MySQL service.

Run mysql-u root-p after restart

Prompt to enter the password and press enter to enter MySQL

Enter the following SQL statement in sequence

1. use mysql; display Database changed
2. update user set authentication_string = password ("123456") where user = "root"; the password to be set is in brackets
3. flush privileges; refresh the database.
4. quit

Delete or comment out skip_grant_tables in the configuration file my. ini.

VII. settings for initial login 

You cannot directly log on to MySQL for the first time. You need to reset the password again. Otherwise, an error is prompted.

ERROR 1820 (HY000): You must set password before executing this statement

Enter the following command:

Set password = password ('20140901 ');

Consistent with the password set in the previous step.

After the settings are complete, MySQL can be used normally. At this time, the root user can only connect through the local machine, as learning is enough.

If you need a remote connection, you need to set it again.

The SQL statement is as follows:

use mysql;show tables;select host,user from user;update user set host='%' where user='root';quitnet stop mysqlnet start mysql 

Note:

The host column specifies the IP addresses that allow users to log on. % is a wildcard. Setting % indicates that any IP Address can access root.

The above is a detailed procedure for installing and configuring MySQL5.7. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.