1. Home
  2. /
  3. Web technology
  4. /
  5. MySql
  6. /
  7. [ Phpmyadmin ] –...

[ Phpmyadmin ] – 透過 Phpmyadmin 一次管理多台遠端資料庫

評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]

這個需求一般來說比較少見,因為預設mysql只允許您連localhost的資料庫,所以通常phpmyadmin也是管理本機的資料庫,這次因為專案需求資料庫拆分了好幾台,安全因素也都只限內網連線,所以對外也沒法直接用phpmyadmin,退而求其次就是透過某台可對外的ip架設phpmyadmin方便管理資料庫。

指令:
nano /etc/phpmyadmin/config.inc.php

先找到該文件的這一段


/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
//$cfg['Servers'][$i]['compress'] = false;
/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

修改成這樣

$i++;//這個一定要加在最前面
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '遠端db連線ip';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
 $cfg['Servers'][$i]['AllowNoPassword'] = false;//TRUE改成false

如果有多組遠端資料庫要管理 就重複上面那一段

2020-1-14 補充
要管理的那台可以不用安裝mysql但要安裝php。遠端mysql的使用者權限要設定好特別是要允許管理那台主機ip要設定才可連進去資料庫。

評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]
!去下營經續永站本助幫能就下一點輕輕,話的您到助幫有章文的我果如 如果我的文章有幫助到您的話,輕輕點一下就能幫助本站永續經營下去!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *