phpMyAdmin
安装
yum install php phpMyAdmin
修改配置文件
/etc/httpd/conf.d/phpMyAdmin.conf
将
Directory /usr/share/phpMyAdmin/
和Directory /usr/share/phpMyAdmin/setup/
两个节点下的Deny from All
改成Allow from All
修改配置文件
/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访问的数据库
查看SELinux
getsebool httpd_can_network_connect
如果上面的命令返回的是
httpd_can_network_connect --> off
则可能需要执行下面命令来打开,不然phpMyAdmin可能连不上mysql数据库
setsebool httpd_can_network_connect 1
重启httpd
service httpd restart
浏览器访问
http://VPS_IP_address/phpmyadmin
主要参考: