【发布时间】:2015-04-07 11:37:46
【问题描述】:
我一直在寻找正确的答案,但没有找到解决方案。我的本地主机上有 WampServer 和 phpMyAdmin。我在远程服务器上的 phpmyadmin 中创建了一个具有所有权限的用户。
- 在文件夹 wamp/apps/phpmyadmin4.1.14/ 我找到了 config.inc.php 文件
并尝试使用以下代码将其连接到远程数据库:
<?php
$i++;
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$i++;
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'mypass';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'example.com';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
?>
因此,在 phpMyAdmin 中我现在有第二台服务器,但是当我选择它时 - 会弹出一个错误。 MySQL 错误 #2002 如下所示:
2002 - 连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应。服务器没有响应(或本地服务器的套接字配置不正确)。
请帮助我错过了什么!
【问题讨论】:
标签: php mysql phpmyadmin config remote-access