在CentOS7上安装phpMyAdmin

该文详细介绍了在CentOS7系统中如何安装phpMyAdmin,包括更换软件源、安装Apache、开启服务,以及修改phpMyAdmin的配置文件以允许特定IP访问。在遇到无法登录的问题时,还提供了修改librarie.config.default.php文件的解决方案。
摘要由CSDN通过智能技术生成

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';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值