连接到远程服务器MySQL问题 [英] Connecting to Remote Server MySQL Issue
问题描述
I'm attempting to connect to a remote server, which I'll refer to as machine A. I've created a user following the instructions here
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
WITH GRANT OPTION;
CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
WITH GRANT OPTION;
在机器A上,我可以运行命令
On machine A I can run the command
mysql -u monty -h website.com -p
这可以毫无问题地连接到sql.但是,当尝试从某些计算机B执行此操作时,我收到错误消息:
This connects to sql with no problem. However, when attempting to do this from some machine B I receive the error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'website.com' (113)
我还注释了以下行:
# bind-address = 127.0.0.1
在/etc/mysql/my.cnf文件中的
.仍然无法通过远程连接进行连接.我可能会缺少任何明显的东西吗?一如既往的反馈非常感谢.
in the /etc/mysql/my.cnf file. Still no luck connecting from a remote connection. Any obvious things that I might be missing? Any feedback as always is very much appreciated.
推荐答案
我认为这是您的GRANT需要修复.
I think it's your GRANT that needs fixing.
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
可能需要
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'website.com'
您将要确保一切安全. 通常最好的做法是尝试不允许不是来自本地主机的外部mysql连接.
You're going to want to make sure things are secure though. It's usually best practice to try not to allow outside mysql connects that aren't from localhost.
这篇关于连接到远程服务器MySQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!