使用 PHPMyAdmin 管理 Amazon RDS [英] Using PHPMyAdmin to administer Amazon RDS

查看:33
本文介绍了使用 PHPMyAdmin 管理 Amazon RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让 PHPMyAdmin 连接到我的 Amazon RDS 实例.我已将我的 IP 地址的权限授予 DB 安全组,该组有权访问我正在尝试访问的此数据库.这就是我正在使用的...

I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with...

    $cfg['Servers'][$i]['pmadb'] = $dbname;
    $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma_relation';
    $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
    $cfg['Servers'][$i]['history'] = 'pma_history';
    $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';

    /* Uncomment the following to enable logging in to passwordless accounts,
     * after taking note of the associated security risks. */
    // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

    /* Advance to next server for rest of config */
    $i++;
}

    $cfg['Servers'][$i]['auth_type'] = 'http';  //is this correct?
    $cfg['Servers'][$i]['user'] = 'MASTER-USER';
    $cfg['Servers'][$i]['password'] = 'MASTER-USER-PASSWORD';
    $cfg['Servers'][$i]['hide_db'] = '(mysql|information_schema|phpmyadmin)';
    /* Server parameters */
    $cfg['Servers'][$i]['host'] = 'MY-DB.us-east-1.rds.amazonaws.com';
    $cfg['Servers'][$i]['connection_type'] = 'socket';
    $cfg['Servers'][$i]['port'] = PORT;

我不确定我的配置是否正确.

I'm not sure if my configuration is correct.

我收到此错误:

#2013 - 在读取初始通信数据包"时失去与 MySQL 服务器的连接,系统错误:110

#2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 110

有人有什么建议吗?

推荐答案

我发现这个问题的大部分答案都缺乏解释.要在EC2中安装的phpMyAdmin中添加RDS服务器,您可以先通过SSH登录您的EC2.然后,发出以下命令来编辑 phpMyAdmin 的配置文件(使用 vinano 或任何其他喜欢的文本编辑工具):

I found most of the answers in this question lack explanation. To add RDS server in phpMyAdmin installed in EC2, you can first login to your EC2 via SSH. Then, issue the following command to edit the Config file of phpMyAdmin (use vi, nano or any other favorite text editing tool):

sudo vi /etc/phpMyAdmin/config.inc.php # Amazon Linux
sudo vi /etc/phpmyadmin/config.inc.php # Ubuntu Linux

config.inc.php中找到以下几行:

/*
 * End of servers configuration
 */

在服务器配置结束"行的上方附加以下几行:

Append the following lines above the "End of servers configuration" line:

$i++;
$cfg['Servers'][$i]['host'] = 'xxxxx.xxxxxxxxxx.us-east-1.rds.amazonaws.com';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['verbose'] = 'YOUR_SERVER_NAME';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = TRUE;

which YOUR_SERVER_NAME 是显示在 phpMyAdmin 登录页面选择框中的名称.如果删除此行,整个 RDS 主机名将显示在选择框中(显然太长了).记得保存config.inc.php.

which YOUR_SERVER_NAME is the name being displayed in phpMyAdmin login page's selection box. If you remove this line, the whole RDS hostname will be displayed in the selection box (which is too long, obviously). Remember to save the config.inc.php.

还有其他几个配置设置,您可以在官方文档中找到详细信息.

There are several other config settings, which you can find the details in the official documentation.

注意:另一个答案建议使用预设用户名自动登录配置文件中的密码:

Note: The other answer suggests auto login with preset username & password in Config file:

$cfg['Servers'][$i]['auth_type']     = 'config';
$cfg['Servers'][$i]['user']          = '__FILL_IN_DETAILS__';
$cfg['Servers'][$i]['password']      = '__FILL_IN_DETAILS__';

如果您的 phpMyAdmin 向公众公开,这将极其危险.您不想向所有人展示您的数据库架构,是吗?如果您真的想使用自动登录,请确保您的 phpMyAdmin 只能通过特定 IP 访问.

which is extremely dangerous if your phpMyAdmin is exposed to public. You don't want to show your database schema to everyone, do you? If you really want to use automatic login, make sure your phpMyAdmin is accessible via specific IPs only.

这篇关于使用 PHPMyAdmin 管理 Amazon RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆