MySql网络问题 [英] MySql networking issue
问题描述
我正在尝试将 MySql Server 从我的机器连接到服务器,以进行开发使用.在服务器中,MySql 运行正常,但我无法远程连接它.
I'm trying to connect MySql Server from my machine to a server, for development using. In the server, MySql is running normaly, but I'm not able to connect it remotely.
我已经检查了 my.cnf 删除了skip-networking"这一行.在服务器中,bin/mysqladmin 变量返回:
I've already cheked my.cnf removing the line "skip-networking". In server, the bin/mysqladmin variables returns:
bin/mysqladmin version -u root -pPASSWORD
bin/mysqladmin Ver 8.42 Distrib 5.5.27, for linux2.6 on x86_64
Copyright (c) 2000, 2011, 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.
Server version 5.5.27-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 5 min 55 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.002
- 服务器:SuSe Linux
- 客户端:Windows 7
- MySql:根据以上信息.
- Windows 7:如果您当前的网络恰好定义为公共网络,则默认情况下会阻止大多数出站端口
- 服务器防火墙.不确定您在服务器本身上运行的是什么(如果有),但请务必检查该连接.
- ISP/数据中心防火墙.许多服务器位于数据中心级别的防火墙后面.例如,对于 AWS,您必须允许通过安全策略进行访问.在 Rackspace,您必须使用他们的工具打开防火墙端口.
会发生什么?谢谢!
推荐答案
如果您使用 MySQL 客户端无法连接,我建议您正在连接的用户不允许远程连接.这是一项必须明确授予的权利(尽管我读过的大多数入门教程都显示创建可以从任何机器访问的用户......这为安全风险打开了大门).
If you could not connect using the MySQL client, I would suggest that the user you are connecting with is not allowed to connect remotely. That is a right that must be explicitly granted (though most beginning tutorials I have read show creating users that have access from any machine... which opens the door to security risks).
示例:
如果您遵循 MySQL 文档 并且做了像这样:
If you followed the MySQL docs and did something like this:
创建用户'jeffrey'@'localhost';
CREATE USER 'jeffrey'@'localhost';
用户 jeffrey 只能从 localhost 登录.
The user jeffrey would only be allowed to log on from localhost.
但是,由于您声明无法使用 Telnet 进行连接,因此我会质疑PS:不是防火墙."
However, since you state that you cannot connect using Telnet, I would challenge the statement "PS: is not the Firewall."
多个防火墙会影响通信路径.
Several firewalls can affect the communication path.
确保您了解可能涉及的所有防火墙.
Make sure you understand all firewalls that may be involved.
@JvdBerg 的建议也是一个很好的建议,以确保您正在聆听所有界面
@JvdBerg's suggestion is also a good one, to ensure you are listening to all interfaces
在my.cnf中bind=0.0.0.0让mysql绑定到所有
in my.cnf bind=0.0.0.0 to let mysql bind to all
这篇关于MySql网络问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!