日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

链接多个数据库的方法

發(fā)布時(shí)間:2025/7/14 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 链接多个数据库的方法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

把下面的代碼 寫到?phpmyadmin的文件里的config.inc.php 文件某處(見下面有說那里)

$connect_hosts = array(
'1'=>array(
"host" => "localhost", //本地服務(wù)器
"user" => "root",
"password" => ""
),
'2' => array(
"host" => "服務(wù)器IP", //服務(wù)器1
"user" => "username",
"password" => "pwd"
),
'3' => array(
"host" => "服務(wù)器ip", //服務(wù)器2
"user" => "username",
"password" => "pwd"
)
);

for ($i=1;$i<=count($connect_hosts);$i++) {

  /* Authentication type */
  $cfg['Servers'][$i]['auth_type'] = 'cookie';
  /* Server parameters */
  $cfg['Servers'][$i]['host'] = $connect_hosts[$i]['host']; //修改host
  $cfg['Servers'][$i]['connect_type'] = 'tcp';
  $cfg['Servers'][$i]['compress'] = false;
  /* Select mysqli if your server has it */
  $cfg['Servers'][$i]['extension'] = 'mysql';
  $cfg['Servers'][$i]['AllowNoPassword'] = true;
  $cfg['Servers'][$i]['user'] = $connect_hosts[$i]['user']; //修改用戶名
  $cfg['Servers'][$i]['password'] = $connect_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';

}

替換位置

這里需要注意:? (下面這個(gè)不用管也行)
(1)for循環(huán)的時(shí)候,i102個(gè)′i = 0’,記得注釋掉。也就是注釋掉無關(guān)的代碼

?

?后記:

找到phpmyadmin文件夾下面的config.sample.inc.php,重命名為config.inc.php 直接在這個(gè)文件下面加上,多個(gè)數(shù)據(jù)庫的代碼,然后覆蓋回原來的config.inc.php ,重啟服務(wù),即可

?

參考:?https://blog.csdn.net/ljfphp/article/details/78717355

轉(zhuǎn)載于:https://www.cnblogs.com/kaibindirver/p/10446831.html

總結(jié)

以上是生活随笔為你收集整理的链接多个数据库的方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。