1. 程式人生 > >在Fedora 27/Fedora 26/25/24上安裝phpMyAdmin

在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