连接到主机上没有';不允许远程连接


connect to mysql database on host that doesn't allow remote connections

我可以访问一台上面有mysql的机器。我想使用Intellij IDEA(在我的个人电脑上)与另一台机器上的数据库对话。另一台机器的my.cnf文件看起来像:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Bind only to localhost
bind-address = 127.0.0.1
# Increased by request
max_allowed_packet=64M
max_connections=302
open_files_limit = 5000

绑定地址行使我无法连接到数据库。我无法修改此文件。有没有办法远程连接到这个数据库,因为我已经可以通过登录从远程系统访问它了?

如果ssh配置为允许端口转发(AllowTcpForwarding yes),则设置端口转发以创建ssh隧道,例如

shh -L 13306:localhost:3306 mysqlserver

建立SSH隧道后,您将在localhost端口13306上连接到MySQL。

您可以通过SSH对MySQL进行隧道传输。

只要谷歌一下。检查一下你的ssh客户端,它可能支持隧道传输(再次谷歌)。