我正在尝试通过我的本地 phpmyadmin 设置(从 xampp 安装)访问我的远程 mysql 服务器。这是我的 phpmyadmin 的 config.inc.php 文件:
/* 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.
最佳答案
您要连接的远程 mysql 服务器必须配置为允许或接受本地主机以外的请求。 检查防火墙是否允许端口 3306(传入和传出)。
现在我们将升级情况:
1) 首先检查 mysql 配置的 my.ini 中的“bind-address”指令,它应该是 0.0.0.0 以允许来自任何 IP 地址的连接。
2) 其次,用户应该拥有我们正在访问的数据库的所有权限。
3) 第三次让 phpmyadmin 在本地主机场景下工作,在你的 phpmyadmin 配置文件的末尾添加这个 ?>(tag):
/* 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 将完成剩下的任务。
希望对您有所帮助。
关于php - 我无法通过本地 phpmyadmin 访问远程 mysql 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43816439/