centos7 安裝phpmyadmin


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM