Mysql

將 phpmyadmin 設置為僅連接到遠端伺服器

  • October 27, 2016

我已經堅持了一段時間,並希望你能提供一些關於我做錯了什麼的見解。

我有一個連接到 RDS (mysql) 數據庫的全新亞馬遜 EC2 (Ubuntu 16.04) 實例,並嘗試在亞馬遜 EC2 實例上安裝 phpmyadmin 以管理 RDS 數據庫。

我遇到的問題是如何配置 phpmyadmin 以便它不安裝本地數據庫,而是簡單地連接到 RDS 實例。(當被問及是否希望 phpmyadmin 為我設置數據庫時,我選擇了否。)

第一次嘗試:

我嘗試將以下內容添加到我的 /etc/phpmyadmin/config.header.inc.php 中:

$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '*************';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

其中 ************* 是我的 RDS 實例的寫入器端點。

但是,這樣做只會產生以下無法使用的登錄頁面: Borked Login Page

第二次嘗試:

我還嘗試將$dbserver/etc/phpmyadmin/config-db.php 更改為我的 RDS 實例的寫入器端點,這在登錄頁面上產生了以下警告:

警告1:

Notice in ./index.php#603
Use of undefined constant PMA_DRIZZLE - assumed 'PMA_DRIZZLE'

Backtrace

警告 2:

Notice in ./libraries/DatabaseInterface.class.php#2665
Use of undefined constant PMA_DRIZZLE - assumed 'PMA_DRIZZLE'

Backtrace

./libraries/db_common.inc.php#24: PMA_DatabaseInterface->isSystemSchema(string '')
./db_structure.php#14: require_once(./libraries/db_common.inc.php)

警告 3:

Notice in ./libraries/DatabaseInterface.class.php#2666
Use of undefined constant PMA_DRIZZLE - assumed 'PMA_DRIZZLE'

Backtrace

./libraries/db_common.inc.php#24: PMA_DatabaseInterface->isSystemSchema(string '')
./db_structure.php#14: require_once(./libraries/db_common.inc.php)

警告 4:

Notice in ./libraries/DatabaseInterface.class.php#2667
Use of undefined constant PMA_DRIZZLE - assumed 'PMA_DRIZZLE'

Backtrace

./libraries/db_common.inc.php#24: PMA_DatabaseInterface->isSystemSchema(string '')
./db_structure.php#14: require_once(./libraries/db_common.inc.php)

警告 5:

Notice in ./libraries/DatabaseInterface.class.php#2668
Use of undefined constant PMA_DRIZZLE - assumed 'PMA_DRIZZLE'

Backtrace

./libraries/db_common.inc.php#24: PMA_DatabaseInterface->isSystemSchema(string '')
./db_structure.php#14: require_once(./libraries/db_common.inc.php)

忽略這些並嘗試登錄,我得到以下資訊:

登錄嘗試錯誤:

#2002 - No such file or directory<br />The server is not responding (or the local server's socket is not correctly configured).

我正在嘗試做的事情是可能的,還是絕對要求 phpmyadmin 有一個本地數據庫才能執行,即使我要訪問的數據庫在遠端機器上?

確保在遠端主機上執行 phpmyadmin 數據庫 SQL 文件:

-- --------------------------------------------------------
-- SQL Commands to set up the pmadb as described in the documentation.
--
-- This file is meant for use with MySQL 5 and above!
--
-- This script expects the user pma to already be existing. If we would put a
-- line here to create him too many users might just use this script and end
-- up with having the same password for the controluser.
--
-- This user "pma" must be defined in config.inc.php (controluser/controlpass)
--
-- Please don't forget to set up the tablenames in config.inc.php
--

-- --------------------------------------------------------
[...]

查看整個文件:https ://github.com/phpmyadmin/phpmyadmin/blob/master/sql/create_tables.sql

引用自:https://serverfault.com/questions/811543