允许MySQL客户端连接:

允许客户端系统连接mysql服务器。
使用ssh登录到远程mysql服务器,然后本地登录到mysql服务器。
现在使用以下命令允许远程客户端。
例如,如果远程客户端的ip是192.168.1.12,并试图通过mysql根帐户连接。
[需要在MySQL服务器上运行以下命令]

# mysql -u root -p
Enter password:

mysql> GRANT ALL ON *.* to jack@oir'192.168.1.12' IDENTIFIED BY 'new-password';
mysql> FLUSH PRIVILEGES;
mysql> quit

我们已经成功地在MySQL服务器中创建了一个新帐户来连接指定的客户端系统。
让我们试着从客户端系统连接。

# mysql -h 192.168.1.10 -u root -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.1.69 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

如何允许远程连接MySQL服务器

很多时候,当我们尝试从客户端系统连接一个远程MySQL服务器时,我们会遇到以下问题,而远程客户端不允许访问这个MySQL服务器,我们会遇到如下问题。

# mysql -h 192.168.1.10 -u root -p
Enter password:

ERROR 1130 (HY000): Host '192.168.1.12' is not allowed to connect to this MySQL server

这个问题是因为,如果客户端系统没有权限连接MySQL服务器。
默认情况下MySQL服务器不允许任何远程客户端连接。

日期:2019-05-19 01:25:27 来源:oir作者:oir