MySQL to turn on remote connectivity

Source: Internet
Author: User

1. Open the cmd window and go to the MySQL installed bin directory

2. Execute the command to log in to the database, and a line will appear for you to enter the password

Mysql-u root-p

3. Execute the following command to assign a new user:

Grant all privileges on * * to ' username ' @ ' IP address ' identified by ' password ';

4. After executing the above command, refresh the permissions with the following command

Flush privileges;

5. Then turn off the MySQL service and start the MySQL service.

===================================================================================

This is a quick configuration method:

The account number is not allowed to log in remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host" item, from "localhost" to "%" or add a user as "%".

To allow all the machines on the LAN to connect to the MySQL database , start the remote connection for MySQL and execute the mysql command on the MySQL server console:

Grant all privileges on * * to [e-mail protected] "%" identified by ' ABC ' with GRANT option;
Flush privileges;

The above two lines of code means that the user named Root, which is connected from any IP address, is given all permissions by the user with the password of ABC. Where the "%" is any IP address, if you want to set a specific value can also be set to a specific value (the contents of the wildcard% increase the host/IP address, you can also directly increase the IP address).

After doing this, the MySQL server within the LAN can be accessed.

MySQL to turn on remote connectivity

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.