A detailed explanation of MySQL remote Access setup method

Source: Internet
Author: User

First, install MySQL. This should not be said much.

Then confirm that My.ini,linux is my.cnf. There is no skip-networking in the document, or the sentence is annotated. Now it seems to be installed after the default is not. (if modified, restart MySQL after modification)


SQL code

The code is as follows Copy Code

mysql> use MySQL;
Mysql> Grant all on *.* to admin@ '% ' identified by ' admin ' with GRANT OPTION;

#这句话的意思, the computer that allows any IP address (above%) to access this MySQL Server with the admin account and password (admin)
#必须加类似这样的帐户 before you can log in remotely. The root account cannot be logged in remotely, it can only be logged locally

mysql> use MySQL;
Mysql> Grant all on *.* to admin@ '% ' identified by ' admin ' with GRANT OPTION;

#这句话的意思, the computer that allows any IP address (above%) to access this MySQL Server with the admin account and password (admin)
#必须加类似这样的帐户 before you can log in remotely. The root account cannot be logged in remotely, it can only be logged locally

or directly increase the fixed IP user

Then add the MySQL user. The specific code is as follows:

The code is as follows Copy Code

--*.* represents permissions. Remote indicates the user name, password represents the password
--172.16.21.39 indicates that the remote address, if used%, means that it can be accessed at any address
GRANT all on *.* to ' remote ' @ ' 172.16.21.39 ' identified by ' password ';
--Set remote to access test database at any address
GRANT all on test.* to ' remote ' @ '% ' identified by ' password ';

At this point, MySQL has been configured, and then to check the firewall, last time I was a firewall toss a morning. Turn on the firewall's 3306 (MySQL port) on the line.

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.