使用 IP 连接到云 SQL
Connect to Cloud SQL using IP
我想使用 IP 连接到 Google 云 SQL 实例(而不是来自其他 google 服务,如 appengine)。要连接,我正在使用 phpMyAdmin 和 MySql,两者都无法连接。
CloudSql 实例详细信息
- 实例类型:
MySQL First Generation
层级:D1
- 版本:
MySQL 5.5
- 授权网络:
::/0
(大家根据documentation)
- 授权用户:没有密码且允许来自任何域的用户 (
%
)
连接客户端规范
- phpMyAdmin
4.6.4
(全新安装)
- MySQL版本
5.5.52-cll
所以我有一个可以从任何地方连接但仍然无法连接的实例。
MySql 使用 ssh
mysql --host=the:ipv6:of:the:instance --user=theusername --password
然后出现错误
ERROR 2003 (HY000): Can't connect to MySQL server on 'the:ipv6:of:the:instance' (110)
PhpMyAdmin config.inc.php
$cfg['Servers'][$i]['host'] = 'the:ipv6:of:the:instance';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['blowfish_secret'] = 'some secret';
这里的错误是:#2003 - Can't connect to MySQL server on 'the:ipv6:of:the:instance' (110) — The server is not responding.
正在验证 ipv6
由于我使用 ipv6 进行连接,因此我必须确认我没有产生幻觉并且我确实是从 ipv6 客户端进行连接。
phpMyAdmin 是 http://[my:own:ipv6:address]/index.php
的 运行 所以毫无疑问我确实在使用 ipv6
[edit] 根据 的建议,我从客户端 运行 ping6 www.google.com
进行了工作,还检查了客户端是否可以通过从另一台计算机对其执行 ping 操作,使用其 ipv6 进行访问(来自 windows:ping -6 my:own:ipv6:address
)
参考资料
- Connecting MySQL Client Using IP Addresses
- Using phpMyAdmin with Cloud SQL on App Engine Standard Environment
- Diagnosing Issues with Cloud SQL Instances
其他我试过的东西
- 另一个用户:root,有密码的用户
- 到另一个新云sql实例
- 检查了控制台 log viewer,没有什么有趣的东西
- 确认在我请求的域上有一个
AAAA
用于我的 ipv6,ip 解析并且我的 dns 工作正常
- 我没有使用代理
任何 帮助连接或至少调试正在发生的事情将不胜感激。我想澄清一下,我不认为自己在网络相关的东西上比新手高。
鉴于两个不同的案例有不同的错误,它们显然是不同的问题。
命令行问题
您通过 SSH 连接到的主机上可能没有 IPv6 连接 - 例如 GCE 没有。要对此进行测试,请尝试 运行 ping6 www.google.com
。您可能还在端口 3306 上设置了出站防火墙。
PHPMyAdmin 问题
您应该使用 $cfg['Servers'][$i]['host']
而不是 $cfg['Servers'][$i]['socket']
。您还需要设置密码,可能还需要设置用户名。你不应该 运行 Cloud SQL 不需要密码。
我想使用 IP 连接到 Google 云 SQL 实例(而不是来自其他 google 服务,如 appengine)。要连接,我正在使用 phpMyAdmin 和 MySql,两者都无法连接。
CloudSql 实例详细信息
- 实例类型:
MySQL First Generation
层级:D1
- 版本:
MySQL 5.5
- 授权网络:
::/0
(大家根据documentation) - 授权用户:没有密码且允许来自任何域的用户 (
%
)
连接客户端规范
- phpMyAdmin
4.6.4
(全新安装) - MySQL版本
5.5.52-cll
所以我有一个可以从任何地方连接但仍然无法连接的实例。
MySql 使用 ssh
mysql --host=the:ipv6:of:the:instance --user=theusername --password
然后出现错误
ERROR 2003 (HY000): Can't connect to MySQL server on 'the:ipv6:of:the:instance' (110)
PhpMyAdmin config.inc.php
$cfg['Servers'][$i]['host'] = 'the:ipv6:of:the:instance';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['blowfish_secret'] = 'some secret';
这里的错误是:#2003 - Can't connect to MySQL server on 'the:ipv6:of:the:instance' (110) — The server is not responding.
正在验证 ipv6
由于我使用 ipv6 进行连接,因此我必须确认我没有产生幻觉并且我确实是从 ipv6 客户端进行连接。
phpMyAdmin 是 http://[my:own:ipv6:address]/index.php
的 运行 所以毫无疑问我确实在使用 ipv6
[edit] 根据 ping6 www.google.com
进行了工作,还检查了客户端是否可以通过从另一台计算机对其执行 ping 操作,使用其 ipv6 进行访问(来自 windows:ping -6 my:own:ipv6:address
)
参考资料
- Connecting MySQL Client Using IP Addresses
- Using phpMyAdmin with Cloud SQL on App Engine Standard Environment
- Diagnosing Issues with Cloud SQL Instances
其他我试过的东西
- 另一个用户:root,有密码的用户
- 到另一个新云sql实例
- 检查了控制台 log viewer,没有什么有趣的东西
- 确认在我请求的域上有一个
AAAA
用于我的 ipv6,ip 解析并且我的 dns 工作正常 - 我没有使用代理
任何 帮助连接或至少调试正在发生的事情将不胜感激。我想澄清一下,我不认为自己在网络相关的东西上比新手高。
鉴于两个不同的案例有不同的错误,它们显然是不同的问题。
命令行问题
您通过 SSH 连接到的主机上可能没有 IPv6 连接 - 例如 GCE 没有。要对此进行测试,请尝试 运行 ping6 www.google.com
。您可能还在端口 3306 上设置了出站防火墙。
PHPMyAdmin 问题
您应该使用 $cfg['Servers'][$i]['host']
而不是 $cfg['Servers'][$i]['socket']
。您还需要设置密码,可能还需要设置用户名。你不应该 运行 Cloud SQL 不需要密码。