Home > Database > Mysql Tutorial > body text

How to solve the problem of Mysql limiting connection and reporting 1130

一个新手
Release: 2017-09-09 14:27:20
Original
1402 people have browsed it

Remotely connect to the MySQL server database, the error code is 1130, ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server
Guess two reasons: one is because of MySQL restrictions, One is firewall restrictions.
1. Solve the firewall restriction:
Turn off the firewall on the MySQL service host or add inbound and outbound rules in the advanced firewall settings, add the MySQL port, and allow access to the host through the MySQL port.

Modify the firewall configuration (the system is different, the firewall configuration file is different) The blogger's is iptables installed under centos7

$ vi /etc/sysconfig/iptables
Copy after login

After opening it, add a line to the configuration file

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
Copy after login

Then save and exit

Restart the firewall (centos7)

systemctlrestart iptables.service
Copy after login

2. Solve the limitations of MySQL and execute the following sql on the MySQL service host

After logging in to mysql on the local machine , change the "host" item in the "user" table in the "mysql" database, rename it from "localhost" to '%'

Log in to mysql

mysql -u root -p
Copy after login

Select the mysql database

mysql;use mysql;
Copy after login

Check the host value of the user table in the mysql library (that is, the host/IP name for connection access)

mysql;select 'host' from user where user='root';
Copy after login

Modify the host value (increase the host/IP address with wildcard % content), of course You can also add the IP address directly
If there is an error in this step "ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'" It means that the record exists, skip this step

mysql;update user set host = '%' where user ='root';
Copy after login

Change permissions (root is the account name, % is the host name (any host), 525099302 is the password You can choose the password yourself)

GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY "525099302";
Copy after login

Refresh permissions, mysql will take effect directly

flush privileges;
Copy after login

Restart the mysql service to complete.

The above is the detailed content of How to solve the problem of Mysql limiting connection and reporting 1130. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!