phpMyAdmin

  1. 安装

    yum install php phpMyAdmin
    
  2. 修改配置文件/etc/httpd/conf.d/phpMyAdmin.conf

    Directory /usr/share/phpMyAdmin/Directory /usr/share/phpMyAdmin/setup/ 两个节点下的 Deny from All 改成 Allow from All

  3. 修改配置文件/etc/phpMyAdmin/config.inc.php

    在数据库中运行下面的命令增加只读用户:

    GRANT SELECT ON *.* TO 'phpmyadmin'@'localhost' identified by '<password>';
    GRANT SELECT ON *.* TO 'phpmyadmin'@'%' identified by '<password>';
    

    设置 mysql 数据库的地址、端口、用户名、密码等

    $cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
    $cfg['Servers'][$i]['user']          = 'phpmyadmin';          // MySQL user
    $cfg['Servers'][$i]['password']      = '<password>';          // MySQL password (only needed
    $cfg['Servers'][$i]['only_db']       = array('vbam','travelzen'); //配置可以通过phpMyAdmin访问的数据库
    
  4. 查看SELinux

    getsebool httpd_can_network_connect
    

    如果上面的命令返回的是

    httpd_can_network_connect --> off
    

    则可能需要执行下面命令来打开,不然phpMyAdmin可能连不上mysql数据库

    setsebool httpd_can_network_connect 1
    
  5. 重启httpd

    service httpd restart
    
  6. 浏览器访问http://VPS_IP_address/phpmyadmin

  7. 主要参考:

results matching ""

    No results matching ""