2017-05-06 171 views
0

我试图通过我的本地phpmyadmin安装程序(从xampp安装)访问我的远程mysql服务器。这里是我的phpmyadmin config.inc.php文件:我无法通过本地phpmyadmin访问远程mysql服务器

/* Authentication type and info */ 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'remote-mysql-server-username'; 
$cfg['Servers'][$i]['password'] = 'remote-mysql-server-pass'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['AllowNoPassword'] = true; 

// remote mysql server 
$cfg['Servers'][$i]['verbose']  = 'remote mysql server'; 
$cfg['Servers'][$i]['host']   = 'some_website.com/'; 
$cfg['Servers'][$i]['port']   = '3306'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress']  = FALSE; 

我得到这个错误:

hpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server. 
+0

明显的问题是服务器,端口和密码等是否正确。那么你能否验证phpmyadmin以外的数据库连接(比如说'ncat')? – KevinO

+0

是的,他们是正确的,因为我通过网络应用程序和SSH连接到我的mysql服务器.. – Dave2345

回答

0

要连接必须配置远程MySQL服务器允许或采取其他请求比本地主机。 检查防火墙允许端口3306(传入和传出)。

现在我们将局势升级:

1)在MySQL配置的my.ini首先检查了“绑定地址”指令应该是0.0.0.0,允许来自任何IP地址的连接。 2)用户应该对我们正在访问的数据库拥有全部权限。

3)第三使本地主机方案phpMyAdmin的工作,你的phpMyAdmin的配置文件年底前>(标签)补充一点:?

/* Remote Server */ 
$i++; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['host'] = 'myinstance.us-1.rds.amazonaws.com';//this is example enter your address 
$cfg['Servers'][$i]['verbose'] = 'Remote Server Name'; 
$cfg['Servers'][$i]['user'] = '**********'; 
$cfg['Servers'][$i]['password'] = '**********'; 

立即登录在本地主机和从当前服务器下拉菜单中选择放下你的服务器名称,phpmyadmin将完成剩下的任务。

希望这会帮助你。

+0

是的,它是端口3306.我是一个亚马逊linux ec2服务,并在控制台中检查 – Dave2345

+0

确定编辑答案请检查 – CoderSam