前言

默认安装phpMyAdmin,通常只能连一台MySQL服务器,其配置信息是保存在phpMyAdmin的配置文件里的,当我们需要在多台服务器之间进行切换登陆的时候,修改起来非常麻烦。遵照下面的配置方法,我们可以方便的使用phpMyAdmin连接多台MySQL。

用phpMyAdmin简化MySQL数据库管理工作


更新历史

2015年08月19日 - 增加Adminer,感谢@BOYPT推荐
2015年08月12日 - 初稿

阅读原文 - https://wsgzao.github.io/post/phpmyadmin/

扩展阅读

配置phpmyadmin使登录时可填写IP管理多台MySQL - http://www.oicto.com/phpmyadmin-mysql-ip/
phpMyAdmin - http://docs.phpmyadmin.net/
LTMP索引 - https://wsgzao.github.io/index/#LTMP


下载文件

1.从官方下载最新的版本
http://www.phpmyadmin.net/downloads/

2.解压上传至服务器中

3.PHP环境搭建可以参考以下文章

LTMP手动编译安装以及全自动化部署实践 - https://wsgzao.github.io/post/ltmp/

方法1

phpMyAdmin允许定义输入的MySQL服务器IP地址,用户名和密码

修改/libraries/config.default.php为真即可,简单安全省事

 $cfg['AllowArbitraryServer'] = true;

方法2

phpMyAdmin修改config.inc.php,服务器地址为下拉列表可选登录多个服务器

增加config.sample.inc.php文件,参考下面配置或者访问setup手动生成

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 4.4.11 setup script
* Date: Fri, 10 Jul 2015 15:54:42 +0800
*/

/* Servers configuration */
$i = 0;

/* Server: 10.4.14.64 [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '10.10.6.64';
$cfg['Servers'][$i]['host'] = '10.10.6.64';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

/* Server: 10.10.1.172 [2] */
$i++;
$cfg['Servers'][$i]['verbose'] = '10.10.1.172';
$cfg['Servers'][$i]['host'] = '10.10.1.172';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

/* End of servers configuration */

$cfg['blowfish_secret'] = '559f78c86f22d8.48481095';
$cfg['DefaultLang'] = 'zh_CN';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

方法3

不多说了,直接看官方的对比报告吧,感谢@BOYPT推荐

Adminer - http://www.adminer.org/

Why is Adminer better than phpMyAdmin?

Replace phpMyAdmin with Adminer and you will get a tidier user interface, better support for MySQL features, higher performance and more security. See detailed comparison.

Adminer development priorities are: 1. Security, 2. User experience, 3. Performance, 4. Feature set, 5. Size.

http://www.adminer.org/en/phpmyadmin/

文章目录
  1. 1. 前言
  2. 2. 更新历史
  3. 3. 下载文件
  4. 4. 方法1
  5. 5. 方法2
  6. 6. 方法3