悠闲博客-blog.yxrjt.cn

phpmyadmin管理多个数据库服务器的配置方法

更新时间:2025-07-01 00:00点击:57

通过whereis查找phpMyAdmin安装目录


[root@localhost ~]# whereis phpMyAdmin

phpMyAdmin: /etc/phpMyAdmin /usr/share/phpMyAdmin

在这两个目录中找到config.inc.php文件,发现在/etc/phpMyAdmin目录中


在开发中有3台数据库服务器需要访问和管理,用客户端切换太过麻烦,直接用phpmyadmin来解决问题


修改根目录/etc/phpMyAdmin中的config.inc.php配置


$i = 0;


/*

 * 服务器A

 */

$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['host'] = '127.0.0.1';

$cfg['Servers'][$i]['port'] = '3307';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['user'] = 'root';

$cfg['Servers'][$i]['password'] = '123456';

$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;

$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';

$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;

$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


/*

 * 服务器B

 */

$i++;

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['host'] = '127.0.0.1';

$cfg['Servers'][$i]['port'] = '3308';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['user'] = 'root';

$cfg['Servers'][$i]['password'] = ‘123456';

$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;

$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';

$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;

$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


/*

 * 服务器C

 */

$i++;

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['host'] = '127.0.0.1';

$cfg['Servers'][$i]['port'] = '3306';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['user'] = 'root';

$cfg['Servers'][$i]['password'] = '123456';

$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;

$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';

$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;

$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';


保存,打开phpmyadmin,在首页就可以看到服务器列表了



栏目分类

联系方式
  • help@yxrjt.cn
  • lgc@yxrjt.cn
  • admin@yxrjt.cn