mysql错误:“1130 - Host ‘192.168.1.1‘ is not allowed to connect to this MySQL server“

The error message "1130 - Host '192.168.1.1' is not allowed to connect to this MySQL server" indicates that the MySQL server rejected the connection from the host with IP address 192.168.1.1. This could be due to one of the following reasons:

1. Authorization restrictions: The access rights of the MySQL server restrict specific host connections. By default, MySQL only allows localhost (localhost) connections. You need to change the access permissions of MySQL to allow connections from other hosts.

2. IP address mismatch: If you manually added an access permission rule and specified a specific IP address, but the actual connected host IP address does not match the rule, this error will appear.

Solution:
Problem: Currently only localhost hosts are authorized to connect to the MySQL server. To allow connections from a host at a specific IP address (for example, 192.168.1.1), follow these steps:

Connect to the MySQL server with a user with sufficient privileges.

Run the following command to add an access permission rule that allows specific hosts to connect:


```bash
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'192.168.1.1' IDENTIFIED BY '密码' WITH GRANT OPTION;

请将 '用户名' 替换为实际的用户名,'密码' 替换为实际的密码。

刷新MySQL权限:


```bash
FLUSH PRIVILEGES;

Exit the MySQL command line:

exit

Guess you like

Origin blog.csdn.net/m0_48096446/article/details/131127946