phpmyadmin连接到远程服务器

我有两台服务器(Ubuntu 10.04和64)。 一个我计划在networking服务器上,另一个我计划成为数据库服务器。 networking服务器是唯一可以访问外部世界的服务器。 我用phpmyadmin安装了一个LAMP栈。 在数据库服务器上,在MySQL中,我创build了一个具有web服务器的内部IP地址主机的用户。 在networking服务器上,我编辑了config-db.php文件,把variables$ dbserver指向数据库服务器的内部IP地址。 当我去phpmyadmin页面login时,我应该期望login使用新创build的用户。 我不能为了我的生活得到这个设置工作。

你是否正确地设置你的phpmyadminconfiguration与服务器的信息你想合作? 请参阅phpmyadmin wiki页面: http : //wiki.phpmyadmin.net/pma/Config#Server.28s.29_configuration

它应该像inputSQL服务器的IP /域一样简单。

另外,您可以在configuration中指定用户名和密码。 但是,如果phpmyadmin网页是外部访问,这将是一个非常糟糕的主意,因为任何人到那个网页将评估到您的SQL服务器。

你也可以考虑编辑config.inc.php而不是config-db.php (就像这里: http : //www.mittalpatel.co.in/access_mysql_database_hosted_remote_server_using_phpmyadmin )

config.inc.php ,定义了您的基本主机。 你可以通过插入这样的内容来添加另外一个:

 <?php // The $i counter should already be incremented, if not, uncomment the next line // $i++; $cfg['Servers'][$i]['host'] = ''; // MySQL hostname or IP address $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port $cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') $cfg['Servers'][$i]['extension'] = 'mysqli'; // The php MySQL extension to use ('mysql' or 'mysqli') $cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (valid choices: config, http, signon or cookie) // 0 enables choosing host via a dropdown menu // 1 sets the first one as default // 2 sets the second one as default // etc. $cfg['ServerDefault'] = 0; ?> 

只需将下面几行添加到底部的“config.inc.php”文件中:

 $i++; $cfg['Servers'][$i]['host'] = 'HostName:port'; //provide hostname and port if other than default $cfg['Servers'][$i]['user'] = 'userName'; //user name for your remote server $cfg['Servers'][$i]['password'] = 'Password'; //password $cfg['Servers'][$i]['auth_type'] = 'config'; // keep it as config 

。 你将得到“当前服务器:”同时下载“127.0.0.1”和一个你提供的“$ cfg ['服务器'] [$ i] ['主机']”服务器之间的凸轮切换。