CentOS7上没有phpMyAdmin的源,先进行换源:
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
安装httpd
yum -y install httpd
设置httpd开机启动
systemctl enable httpd.service
启动httpd
systemctl restart httpd
安装phpMyAdmin
yum install php php-mcrypt mod_ssl phpmyadmin -y
耐心等待安装完成,之后修改配置文件,允许自己的IP地址可以访问
vi /etc/httpd/conf.d/phpMyAdmin.conf
找到 Require ip 对应行,注释掉。
添加为 Require all granted
如下所示
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1 #注释掉
# Require ip ::1 #注释掉
Require all granted #新添加
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1 #注释掉
# Require ip ::1 #注释掉
Require all granted #新添加
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
启动httpd
systemctl restart httpd
登录 服务器ip/phpmyadmin,账号密码为mysql账号密码
错误
无法登录服务器
修改配置文件
vi /usr/share/phpMyAdmin/libraries/config.default.php
将下列中的localhost改为127.0.0.1,还不能登录的话修改为服务器IP
$cfg['Servers'][$i]['host'] = '127.0.0.1';