1. 安装 php

  1. yum install php

2. 安装 epel

  1. yum install epel-release
  2. rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

3. 安装 phpMyAdmin

  1. yum install phpmyadmin

4. 修改配置文件

  1. vim /etc/httpd/conf.d/phpMyAdmin.conf
  • Require ip xxx 修改为 Require all granted,共4处需要修改,修改后文件如下: ```

    phpMyAdmin - Web based MySQL browser written in php

    Allows only localhost by default

    #

    But allowing phpMyAdmin to anyone other than localhost should be considered

    dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin

AddDefaultCharset UTF-8 # Apache 2.4 # Require ip 127.0.0.1 # Require ip ::1 Require all granted # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 # Apache 2.4 # Require ip 127.0.0.1 # Require ip ::1 Require all granted # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1

These directories do not require access over HTTP - taken from the original

phpMyAdmin upstream tarball

#

Order Deny,Allow Deny from All Allow from None # Allow from All Order Deny,Allow Deny from All Allow from None Order Deny,Allow Deny from All Allow from None

This configuration prevents mod_security at phpMyAdmin directories from

filtering SQL etc. This may break your mod_security implementation.

#

SecRuleInheritance Off

  1. <a name="4be012cf"></a>
  2. #### 5. 修改数据库的配置
  3. ```shell
  4. vim /etc/phpMyAdmin/config.inc.php
  • 修改文件中对应的配置即可。
  • 假如需要配置多个数据库连接,只需要添加多套配置即可。
    $i++;
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    $cfg['Servers'][$i]['host'] = '127.0.0.1';
    $cfg['Servers'][$i]['port'] = '3307';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['user'] = '';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
    $cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
    $cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
    $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
    

6. 重启服务

systemctl restart httpd

7. 访问

http://ip/phpmyadmin

8. phpMyAdmin 默认安装位置

/usr/share/phpMyAdmin