[英]Connect local phpMyAdmin with remote server - error #2002
I have been searching for a right answer and no luck with solutions. 我一直在寻找正确的答案,没有运气好的解决方案。 I have WampServer and phpMyAdmin on my localhost.
我的本地主机上有WampServer和phpMyAdmin。 I have created a user in phpmyadmin on remote server with all privilages.
我已经在具有所有特权的远程服务器上的phpmyadmin中创建了一个用户。
And tried to connect it to the remote databases with the following code: 并尝试使用以下代码将其连接到远程数据库:
<?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;
?>
And, as a result, in phpMyAdmin now I have 2nd server, but when I choose it - an error pops-up. 结果,现在在phpMyAdmin中,我有第二台服务器,但是当我选择它时-会弹出一个错误。 MySQL error #2002 that looks like this:
MySQL错误#2002看起来像这样:
Please help what am I missing! 请帮助我所缺少的!
You are suffering from a failure of communication between your machine and the server. 您的机器与服务器之间的通信失败。 If it was permission, you wouldn't get a dead request, you would get the permission error.
如果是权限,则不会收到无效请求,而会出现权限错误。
You have 2 connections listed there so it will show 2 connections. 您在那里列出了2个连接,因此它将显示2个连接。
So for your current config the 2nd server listed is trying to connect to " example.com " server if you are trying to connect to this server make sure you have allowed remote connection's set up, and account privileges also for remote access. 因此,对于您当前的配置,如果您尝试连接到“ example.com ”服务器,则列出的第二台服务器将尝试连接到该服务器,请确保您已允许设置远程连接,并且还具有用于远程访问的帐户特权。
If your not trying to connect to " example.com " change these lines to the remote host you want to connect to. 如果您不尝试连接到“ example.com ”,请将这些行更改为要连接的远程主机。
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'mypass';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'example.com';
You may need to add in port as well 您可能还需要添加端口
$cfg['Servers'][$i]['port'] = '3307'; // MySQL port
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.