Fix server connection Error host ' XXX ' is not allowed to connect to this MySQL server

Source: Internet
Author: User
Tags mysql in

This time in the study of the locomotive storage tutorial, in the "Configure login information and database (MySQL)" Connection, "Server connection Error" "Host ' XXX ' is not allowed to connect to this MySQL server" error. Errors like this are typical remote permissions issues.

The crux of the problem is that MySQL does not have permission to open Telnet. It depends on the type of system your server is using, Linux or Windows, which is a different solution. The solution is to open the MySQL remote login account.

There are two major strides:

1. Determine that the firewall on the server does not block port 3306.

MySQL default port is 3306, need to determine the firewall does not block 3306 port, otherwise remote is unable to connect via 3306 port to MySQL.

If you specified a different port when you installed MySQL, open the port number that you specified for MySQL in the firewall.

If you don't know how to set up a firewall on your server, check with your server administrator.

2, add to allow remote connection to MySQL users and authorized.

1) Login to MySQL

2) Create a remote login user and authorize the operation on the server to be linked

Mysql> Grant all privileges the db_name.* to ' username ' @ ' xxx.xxx.xx.x ' identified ' password ' with Grant OPTION;

The above statement indicates that all permissions for the database db_name are authorized to username this user, allowing username users to remotely log in xxx.xxx.xx.x this IP, and set the username user's password to password.

Analysis Parameters:

All privileges means giving all permissions to the specified user, which can also be replaced by assigning a specific permission, such as: Select,insert,update,delete,create,drop, and so on, with the "," half-width comma separated by the specific permissions.

Db_name.* means that the above permissions are for which table, db_name refers to the database name, followed by the * for all tables, it can be inferred that: for all of the database is authorized as "*. *" For all tables, the entire table for a database is authorized as "database name. *", A table for a database is authorized as the database name. Table name.

Username indicates which user you want to authorize, the user can be a user who exists, or it can be a non-existent user.

xxx.xxx.xx.x indicates that the IP address of the remote connection is allowed, your IP is set to "%" if you want to not restrict the IP of the link.

Password The password for the user username.

After the last execution of the above statement, it will generally take effect immediately, the return value is as follows:

Query OK, 0 rows affected (0.01 sec)


If you do not have the above statement, then execute the following command, which will take effect immediately.

Mysql> Flush Privileges

Fix server connection Error host ' XXX ' is not allowed to connect to this MySQL server

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.