abb*_*ood 3 mysql ssh ssh-tunnel amazon-web-services
我试图将在 rubymine 上进行 AWS 调试的任务分解成更小的块。我想连接到在 AWS 上运行的 mysql 服务器。所以我做了以下事情:
第一:建立一个 ssh 隧道,将所有本地主机请求转发到 3307 端口到 AWS 上的 3306 端口:
ssh -l ubuntu -i 'path/to/private/key/privateKey.cer' -L 3307:aws.port:3306 aws.port -N -v -v
Run Code Online (Sandbox Code Playgroud)
第二:在端口 3307 上连接到 mysql
mysql -h 127.0.0.1 -P 3307 -u root -p
Run Code Online (Sandbox Code Playgroud)
问题: 它在我的主机上失败并出现以下错误:
ERROR 1130 (HY000): Host '178.135.138.61' is not allowed to connect to this MySQL server
Run Code Online (Sandbox Code Playgroud)
AWS 上的日志输出如下:
debug1: Connection to port 3307 forwarding to 54.193.1.19 port 3306 requested.
debug2: fd 7 setting TCP_NODELAY
debug1: channel 2: new [direct-tcpip]
channel 2: open failed: connect failed: Connection refused
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 3307 for 54.193.1.19 port 3306, connect from 127.0.0.1 port 64938, nchannels 3
Run Code Online (Sandbox Code Playgroud)
笔记:
ssh
端口 22 上的连接/etc/hosts.deny
在 AWS 上没有列出 localhost 或 127.0.0.1。想法?
错误信息
ERROR 1130 (HY000): Host '178.135.138.61' is not allowed to connect to this MySQL server
Run Code Online (Sandbox Code Playgroud)
来自 MySQL。要允许 root 用户远程访问,那么您需要在 mysql 服务器上为特定数据库专门允许此访问
mysql -u root -p
mysql> grant all privileges on somedatabase.* to 'root'@'178.135.138.61' identified by 'somepassword';
mysql> flush privileges;
Run Code Online (Sandbox Code Playgroud)
这将允许用户名 root 从 178.135.138.61 连接到 mysql,并具有某些数据库的所有权限。
您可能应该通读MySQL 安全文档,特别是访问控制和用户管理章节。
归档时间: |
|
查看次数: |
2259 次 |
最近记录: |