在Fedora 27/Fedora 26/25/24上安装phpMyAdmin

phpMyAdmin是用于管理MySQL,MariaDB和Drizzle服务器的基于Web的管理工具; 它有助于执行数据库活动,如创建,删除,查询,表,列,关系,索引,用户,权限等。

安装 phpMyAdmin

使用以下命令安装phpMyAdmin。

dnf -y install phpmyadmin httpd

配置 phpMyAdmin

默认情况下,phpMyAdmin将web配置文件放在/etc/httpd/conf.d目录中; 它有规则和访问权限。 phpMyAdmin只能从localhost访问,以改变它; 我们必须编辑phpMyadmin.conf文件。

在Fedora中,Web访问由mod_authz_core.c模块管理; 所以正常的允许或拒绝规则即使你修改也行不通。

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

默认配置如下所示。

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<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
     </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
     </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>

请注释掉需要ip 127.0.0.1并且要求ip :: 1然后在注释行中添加要求所有授予的权利。 它将如下所示。

 Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<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>

重新启动Apache服务。

systemctl restart httpd

配置防火墙以允许来自外部网络的HTTP请求。

firewall-cmd --permanent --add-service=http
firewall-cmd --reload

访问phpMyAdmin

现在从浏览器访问phpMyAdmin,URL将是

http://your-ip-address/phpMyAdmin

以root用户身份登录(数据库管理员)或数据库用户。

在Fedora 27/Fedora 26/25/24上安装phpMyAdmin

猜你喜欢

转载自www.linuxidc.com/Linux/2018-12/155691.htm