我已经在这个问题上停留了一段时间,希望您能对我做错的事情提供一些见解。
我有一个新的亚马逊 EC2(Ubuntu 16.04)实例连接到 RDS(mysql)数据库,并且正在尝试在亚马逊 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 登录页面
第二次尝试:
我还尝试将$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 有一个本地数据库才能运行,即使我想要访问的数据库位于远程机器上?
答案1
确保在远程主机上运行 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