繁体   English   中英

如何从外部PHPMyAdmin安装连接到Google Cloud SQL实例?

[英]How to connect to a Google cloud SQL instance from an external PHPMyAdmin installation?

我正在尝试将现有的PHPMyAdmin连接到第二台服务器,这是具有SSL的Google Cloud SQL第二代mysql服务器。 我当前的设置是:

具有Ubuntu 16.04,phpmyadmin和mariadb Google Cloud SQL实例的VPS A

当使用ssh连接到VPS A时,我可以使用命令行连接到Google Cloud实例,因此连接原则上似乎可行,但是我的phpmyadmin配置一定存在问题:

mysql --ssl-ca=/xxx/server-ca.pem --ssl-cert=/xxx/client-cert.pem --ssl-key /xxx/client-key.pem -h xxx.xxx.xxx.xxx -u phpmyadmin -p

这是我的phpmyadmin配置(/var/lib/phpmyadmin/config.inc.php):

$i++;
$cfg['Servers'][$i]['verbose'] = 'VPS A';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['nopassword'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'password';

$i++;
$cfg['Servers'][$i]['verbose'] = 'gcloud';
$cfg['Servers'][$i]['host'] = 'xxx.xxx.xxx.xxx';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'phpmyadmin';
$cfg['Servers'][$i]['password'] = 'same pw I used with the commandline';
$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['key'] = '/xxx/client-key.pem';
$cfg['Servers'][$i]['cert'] = '/xxx/client-cert.pem';
$cfg['Servers'][$i]['ca'] = '/xxx/server-ca.pem';
$cfg['Servers'][$i]['capath'] = NULL;
$cfg['Servers'][$i]['cipher'] = NULL;
$cfg['Servers'][$i]['extension'] = 'mysqli';

现在,当我访问phpmyadmin登录页面时,可以选择gcloud作为服务器,输入与我刚得到的命令行连接相同的凭据:

#1045 - Access denied for user 'xxx'@'xxx.xxx.xxx.xxx' (using password: YES)

但是与localhost mariadb的连接工作正常。 我哪里做错了?

更新:阅读以下内容: https : //docs.phpmyadmin.net/en/latest/config.html#example-google-ssl

我发现我必须添加$cfg['Servers'][$i]['ssl_verify'] = false; 但这没有帮助。

更新:使用PPA将phpmyadmin更新到最新版本后,我收到另一个错误,谷歌搜索导致我这样做: https : //github.com/phpmyadmin/phpmyadmin/issues/12929

我应用了解决方法,但新错误消失了,但是我仍然无法登录:

 mysqli_real_connect(): (HY000/1045): Access denied for user 'xxx'@'xxx.xxx.xxx.xxx' (using password: YES)

在Stackoverflow中有类似的旧情况,所有解决方案都指向用户权限未定义。 我认为了解该问题最有用的职位就是这一职位。 考虑到您使用的是PHPMyAdmin,请参阅此drupal问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM