Solution to MySQL remote connection failure

Source: Internet
Author: User

After the remote connection to SQL Server 2005 was completed last time, it is now MySQL's turn... think back to the connection string connecting to the MySQL database:

Server =Localhost; Database = gyl; uid = root; Pwd = 111111;

The value of the server is localhost... it supports local... you just need to change localhost to an IP address. It is easy to think about it, but it is an error...

Error description:Host '60 -248-32-13.hinet-ip.hinet.net 'is not allowed to connect to this MySQL Server

In fact, MySQL does not support remote access by default. It is the default MySQL user root does not support remote access by default, because it is localhost...

To put it bluntly, that is, permission issues. The root user's host is localhost by default...

The following solution is to re-create a user and support remote access without modifying the root permission. We recommend that you do this by calling...

 

1. First, log on with the root user

2. Enter the following statement to create a new user and grant the corresponding permissions.

Grant select, insert, update, delete on [db_name]. * to [username] @ [ip_address] identified by '[Password]'; 

Note:

[Db_name]: indicates the name of the database to be opened to new users.

[Username]: New User Name
[Password]: the password of a new user,Enclose the letter with quotation marks (')

[Ip_address]: The DNS name after IP address or IP address Lookup

 

Important Notes: (My experience ,(~ O ~)~ Zz)

(1). If you want to grant all operation Permissions

GrantAllOn... to user name ......

(2) If you want to grant permissions to all tables in all databases

Grant... on*.*To username ......

(3) If you want to grant all tables of a Database

Grant... onDatabase Name .'*'To username ......([*] Single quotation marks must be added on both sides)

(4) If you want to assign a table to a database

Grant... onDatabase Name. Table NameTo username ......

(5). If you want to allow remote access from any client using the user name

Grant... on...Username @ %.......(Change the IP address to [%])

(6) You must restart the MySQL service after the modification.

 

Other Instructions:

Do you want to see which table these users are in?

Use MySQL;
Select host, user, password from user;

The Host field indicates the host to log on...

 

Okay... after writing... going to bed... mom and dad good night... Hee \ (^ o ^ )/~

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.