Troubleshoot 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 of the storage tutorial, in the "Configuration login information and database (MySQL)" Connection, the "Server connection Error host ' XXX ' is not allowed to connect to" "error. Like this error, is a typical remote permissions problem.

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

There are two major strides:

1, make sure that the firewall on the server does not block 3306 ports.

MySQL default port is 3306, you need to determine that the firewall does not block 3306 ports, or remote can not connect through 3306 ports to MySQL.

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

If you do not know how to set up a firewall on your server, please consult your server administrator.

2, increase allow remote connection MySQL user and authorization.

1 First login to MySQL with root account

Click the Start menu in the Windows host, run, enter "cmd", enter the console, enter the MySQL bin directory, and enter the following command.

Mysql–u root–p 123456

123456 is the password for the root user.

In the Linux host, enter the following command at the command prompt. (How to login to the Linux VPS MySQL?) )

Input:/usr/local/mysql/bin/mysql-u root–p

Then enter the password before entering.

2 Create a remote login user and authorize


Mysql> grant all privileges in shujukuming.* to ' yonghuming ' @ ' 192.168.1.1 ' identified by ' 123456 ' with Grant OPTION;

The above statement means that all permissions on the database shujukuming are authorized to the yonghuming user, allowing yonghuming users to remotely log on 192.168.1.1 this IP and set the yonghuming user's password to 123456.

Analyze all the parameters individually:

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

shujukuming.* indicates which table the above permissions are for, shujukuming refers to the database, and the following * means that for all tables, it is possible to infer that all tables for all databases are authorized to be "*.*" and that all tables for a database are authorized to "database name. *" , a table for a database is authorized as the database name. Table name.

yonghuming says which user you want to authorize, this user can be a user who exists, or it can be a nonexistent user.

192.168.1.1 represents an IP address that allows remote connections, or "%" if you want to not restrict the link's IP.

123456 is the user's password.

After executing the above statement, it will generally take effect immediately and the return value is as follows:

Query OK, 0 rows affected (0.01 sec)
If you do not have the above statement, follow the command below to take effect immediately.

Mysql> Flush Privileges

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.