Apache下配置phpmyadmin

在已安装Apache+PHP+Mysql环境下:

# cd /usr/local/apache/htdocs(发布到Apache的项目都放在此目录下)
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.4.4/phpMyAdmin-4.4.4-all-languages.zip/download

# cp phpMyAdmin-4.4.4-all-languages.zip phpmyadmin.zip

# tar -zxvf phpmyadmin.zip

# vi phpmyadmin/config.inc.php(在此文件中配置要连接的服务器IP及用户名密码)

修改如下:
添加hosts数组,for循环遍历
$hosts = array(
   '1' => array('host' => 'ip1','user'=>'username1','password' => 'pswd1'),
   '2' => array('host' => 'ip2','user'=>'username2','password' => 'pswd2'),
   '3' => array('host' => 'ip3','user'=>'username3','password' => 'pswd3'),
);
for($i=1;$i<=count($hosts);$i++){
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
  $cfg['Servers'][$i]['host'] = $hosts[$i]['host'];
  $cfg['Servers'][$i]['connect_type'] = 'tcp';
  $cfg['Servers'][$i]['compress'] = false;
  $cfg['Servers'][$i]['AllowNoPassword'] = false;
  $cfg['Servers'][$i]['user'] = $hosts[$i]['user'];
  $cfg['Servers'][$i]['password'] = $hosts[$i]['password'];
}

在浏览器输入ip1:8080/phpmyadmin就可以访问了
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页