内容纲要

配置文件

  1. 配置需要修改在config.inc.php文件中,改在config.default.php有些配置不会生效...至于为啥不生效我也不知道为啥...比如设置多数据库连接
  2. config.inc.php的文件位置在phpmyadmin根目录,但是默认可能不存在
    1. 根目录下是否有config.sample.inc.php文件,如果存在,那么将其改名为config.inc.php
    2. phpmyadmin/libraries目录下将config.default.php复制到phpmyadmin根目录下并改名为config.inc.php

关于这两个配置文件的关系,config.default.php里是默认配置。config.inc.php中没有设置的选项将使用config.default.php的配置。config.inc.php是用户定义的配置文件,可以覆写config.default.php里的配置。


连接多个数据库

  • 方法一
    修改config.inc.php
/**
 * allow login to any user entered server in cookie based authentication
 *
 * @global boolean $cfg['AllowArbitraryServer']
 */
$cfg['AllowArbitraryServer'] = false;
将false改为true就可以自定义连接数据库了,但是数据库地址需要手填

好处是隐藏了数据库地址,
坏处就是占用大脑内存,还需要手动输入

如果不允许陌生人用来连接他人的数据库可以设置ip限制
/**
 * restrict by IP (with regular expression) the MySQL servers the user can enter
 * when $cfg['AllowArbitraryServer'] = true
 *
 * @global string $cfg['ArbitraryServerRegexp']
 */
$cfg['ArbitraryServerRegexp'] = '';
  • 方法二
    依旧修改config.inc.php
// 直接在第一个Servers配置下面增加一个数据库配置
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = ''
// 配置可根据自己所需怎加,具体参考第一个Servers配置
也可以写的稍微优美一点
$connect_hosts = array(
    '1'=>array(
        "verbose" => "服务器1",
        "host" => "127.0.0.1",
        "port" => "3306"
    ),
    '2' => array(
        "verbose" => "服务器2",
        "host" => "127.0.0.1",
        "port" => "3307"
    ),
    '3' => array(
        "verbose" => "服务器3",
        "host" => "127.0.0.2",
        "port" => ""
    )
);
for ($i=1;$i<=count($connect_hosts);$i++) {
     $cfg['Servers'][$i]['verbose'] = $connect_hosts[$i]['verbose'];
     $cfg['Servers'][$i]['host'] = $connect_hosts[$i]['host'];
     $cfg['Servers'][$i]['port'] = $connect_hosts[$i]['port'];
     $cfg['Servers'][$i]['auth_type'] = 'cookie';
    //其他的参数我这里省略了,各位可以参考默认的配置文件
}
//注:不要从0开始

配置文件需要一个短语密码 & 配置文件中的密文(blowfish_secret)太短

根据要求设置就好了,我当前使用的5.0.2版本要求是46位

修改config.inc.php

/**
 * The 'cookie' auth_type uses AES algorithm to encrypt the password. If
 * at least one server configuration uses 'cookie' auth_type, enter here a
 * pass phrase that will be used by AES. The maximum length seems to be 46
 * characters.
 *
 * @global string $cfg['blowfish_secret']
 */
$cfg['blowfish_secret'] = '6ByrsewvG*^kL4zS*iGgqh%QbS5w5E3q##T9c!5sbwd4Jh';

服务器和客户端上指示的HTTPS之间不匹配。这可能导致phpMyAdmin无法正常工作或存在安全风险。请修复您的服务器配置以正确指示HTTPS。

问题原因是网关https协议代理http协议的phpMyAdmin

/**
 * Your phpMyAdmin URL.
 *
 * Complete the variable below with the full URL ie
 *    https://example.com/path_to_your_phpMyAdmin_directory/
 *
 * It must contain characters that are valid for a URL, and the path is
 * case sensitive on some Web servers, for example Unix-based servers.
 *
 * In most cases you can leave this variable empty, as the correct value
 * will be detected automatically. However, we recommend that you do
 * test to see that the auto-detection code works in your system. A good
 * test is to browse a table, then edit a row and save it.  There will be
 * an error message if phpMyAdmin cannot auto-detect the correct value.
 *
 * @global string $cfg['PmaAbsoluteUri']
 */
$cfg['PmaAbsoluteUri'] = 'https://phpmyadmin.yourdomain.com';

未完待续...