配置phpMyAdmin连接多实例MySQL

cp config.sample.inc.php config.inc.php
vim config.inc.php

/**
 * First server
 */
//$i++;
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'master.rds.aliyun.com';
//$cfg['Servers'][$i]['compress'] = false;
//$cfg['Servers'][$i]['AllowNoPassword'] = false;

$hosts = array(
  '1' => array('host'=>'master.rds.aliyun.com', 'port'=>3306),
  '2' => array('host'=>'slave.rds.aliyun.com', 'port'=>3306)
);

for ($i=1; $i<=count($hosts); $i++) {
  /* Authentication type */
  $cfg['Servers'][$i]['auth_type'] = 'cookie';
  /* Server parameters */
  $cfg['Servers'][$i]['host'] = $hosts[$i]['host'];  //修改host
  $cfg['Servers'][$i]['port'] = $hosts[$i]['port']; 
  $cfg['Servers'][$i]['connect_type'] = 'tcp';
  $cfg['Servers'][$i]['compress'] = false;
  /* Select mysqli if your server has it */
  $cfg['Servers'][$i]['extension'] = 'mysqli';
  //$cfg['Servers'][$i]['AllowNoPassword'] = true;
  //$cfg['Servers'][$i]['user'] = $hosts[$i]['user'];  //修改用户名
  //$cfg['Servers'][$i]['password'] = $hosts[$i]['password'];  //密码
  /* rajk - for blobstreaming */
  $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';
}

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/24/config-phpmyadmin-connect-to-multiple-instances-of-mysql/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
配置phpMyAdmin连接多实例MySQL
cp config.sample.inc.php config.inc.php vim config.inc.php /** * First server */ //$i++; /* Authentication type */ //$cfg['Servers'][$i……
<<上一篇
下一篇>>
文章目录
关闭
目 录