在 CentOS 7 上安装 phpMyAdmin

10 篇文章 0 订阅
7 篇文章 1 订阅

转发自:https://blog.csdn.net/u011304615/article/details/78871479

在CentOS上安装phpMyAdmin,你第一步需要架设一台Web服务器(如Apache或nginx),安装好MySQL/MariaDB数据库和PHP。根据你的偏好和需求,你可以从LAMP和LEMP中选择一种安装。

先安装epel,不然安装pgpmyadmin时会出现找不到包。

yum install epel-release

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

安装

sudo yum install phpmyadmin

在CentOS 7上配置phpMyAdmin

默认情况下,CentOS 7上的phpMyAdmin只允许从回环地址(127.0.0.1)访问。为了能远程连接,你需要改动它的配置。

用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉带有”Require ip XXXX”字样的代码行。会有四处这样的代码行,用”Require all granted”取而代之。重新改动过的配置文件如下所示。

sudo vi /etc/httpd/conf.d/phpMyAdmin.conf

修改后的文件内容

    <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使改动生效。

sudo systemctl restart httpd

测试

ip/phpmyadmin

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值