When I try to connect with putty I get 'host is not allowed to connect to this mysql server'. Why is that happening? Host and client are on my machine.
当我尝试连接putty,我得到“不允许主机连接到这个mysql服务器”。这是为什么发生?主机和客户端在我的机器上。
When I connect with the command line it connects.
当我连接到命令行时,它连接。
1 个解决方案
#1
32
You need to change how your configuration is set up.
您需要更改配置的设置方式。
Comment out the skip-networking section within your MySQL config: # skip-networking
, if you have skip-networking
it will discard any TCP/IP connection which is likely why your failing.
在MySQL配置中注释掉skip-networking部分:# skip-networking,如果你有skip-networking,它会丢弃任何TCP/IP连接,这可能是你失败的原因。
Once you have enabled your TCP/IP connections you will need to grant permission to your user to connect from other machines:
一旦启用了TCP/IP连接,您就需要授予用户从其他机器连接的权限:
GRANT ALL PRIVILEGES ON *.* TO <username>@'%' IDENTIFIED BY '<password>';
授予*的所有特权。*至 <用户名> @'%',由' <密码> '识别;
This will let username connect from any machine to your database with the appropriate password.
这将允许用户名从任何机器连接到您的数据库使用适当的密码。
#1
32
You need to change how your configuration is set up.
您需要更改配置的设置方式。
Comment out the skip-networking section within your MySQL config: # skip-networking
, if you have skip-networking
it will discard any TCP/IP connection which is likely why your failing.
在MySQL配置中注释掉skip-networking部分:# skip-networking,如果你有skip-networking,它会丢弃任何TCP/IP连接,这可能是你失败的原因。
Once you have enabled your TCP/IP connections you will need to grant permission to your user to connect from other machines:
一旦启用了TCP/IP连接,您就需要授予用户从其他机器连接的权限:
GRANT ALL PRIVILEGES ON *.* TO <username>@'%' IDENTIFIED BY '<password>';
授予*的所有特权。*至 <用户名> @'%',由' <密码> '识别;
This will let username connect from any machine to your database with the appropriate password.
这将允许用户名从任何机器连接到您的数据库使用适当的密码。