国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

在CentOS上安裝phpMyAdmin的教程

2024-07-24 13:07:28
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了在CentOS上安裝phpMyAdmin的教程,phpMyAdmin是一款借助PHP腳本來操作MySQL的工具,非常具有人氣,需要的朋友可以參考下

前提

在CentOS上安裝phpMyAdmin,你第一步需要架設一臺Web服務器(如Apache或nginx),安裝好MySQL/MariaDB數據庫和PHP。根據你的偏好和需求,你可以從LAMP和LEMP中選擇一種安裝。

另一個要求是允許在你的CentOS上安裝EPEL庫。如果你還沒設置過請猛戳這里。

在CentOS6或7上安裝phpMyAdmin

一旦你設置了EPEL庫,你就能輕松地用以下命令安裝phpMyAdmin了。

在CentOS 7上:

 

 
  1. $ sudo yum install phpmyadmin  

在CentOS 7上:

 

 
  1. $ sudo yum install phpmyadmin php-mcrypt  

在CentOS 7上配置phpMyAdmin

默認情況下,CentOS 7上的phpMyAdmin只允許從回環地址(127.0.0.1)訪問。為了能遠程連接,你需要改動它的配置。

用文本編輯器打開phpMyAdmin的配置文件(路徑:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注釋掉帶有"Require ip XXXX"字樣的代碼行。會有四處這樣的代碼行,用"Require all granted"取而代之。重新改動過的配置文件如下所示。

 

 
  1. $ sudo vi /etc/httpd/conf.d/phpMyAdmin.conf  
  2.  
  3. . . . . . 
  4. <Directory /usr/share/phpMyAdmin/> 
  5. AddDefaultCharset UTF-8 
  6.  
  7. <IfModule mod_authz_core.c> 
  8. # Apache 2.4 
  9. <RequireAny> 
  10. #Require ip 127.0.0.1 
  11. #Require ip ::1 
  12. Require all granted 
  13. </RequireAny> 
  14. </IfModule> 
  15. <IfModule !mod_authz_core.c> 
  16. # Apache 2.2 
  17. Order Deny,Allow 
  18. Deny from All 
  19. Allow from 127.0.0.1 
  20. Allow from ::1 
  21. </IfModule> 
  22. </Directory> 
  23.  
  24. <Directory /usr/share/phpMyAdmin/setup/> 
  25. <IfModule mod_authz_core.c> 
  26. # Apache 2.4 
  27. <RequireAny> 
  28. #Require ip 127.0.0.1 
  29. #Require ip ::1 
  30. Require all granted 
  31. </RequireAny> 
  32. </IfModule> 
  33. <IfModule !mod_authz_core.c> 
  34. # Apache 2.2 
  35. Order Deny,Allow 
  36. Deny from All 
  37. Allow from 127.0.0.1 
  38. Allow from ::1 
  39. </IfModule> 
  40. </Directory> 
  41. . . . . . 

最后,重啟httpd使改動生效。

 

 
  1. $ sudo systemctl restart httpd  

在CentOS 6上配置phpMyAdmin

默認情況下,CentOS 6上的phpMyAdmin是禁止從每個IP地址訪問的。為了能遠程連接,你需要改動它的配置。

用文本編輯器打開phpMyAdmin的配置文件(路徑:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注釋掉"Deny from all"字樣的代碼行。然后把"Allow from 127.0.0.1"字樣的代碼行改成"Allow from 0.0.0.0"。重新改動過的配置文件如下所示。

 

 
  1. $ sudo vi /etc/httpd/conf.d/phpmyadmin.conf  
  2.  
  3. <Directory "/usr/share/phpmyadmin"
  4. Order Deny,Allow 
  5. # Deny from all 
  6. Allow from 0.0.0.0 
  7. </Directory> 

下一步是將phpMyAdmin的配置文件用blowfish加密工具加密。這一步需要加密cookie里的密碼來作為基于cookie的部分認證。

用文本編輯器打開如下路徑所示的文件并且用blowfish設置一個隨機密碼,如下所示。

 

 
  1. $ sudo vi /usr/share/phpmyadmin/config.inc.php  
  2.  
  3. $cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'/* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ 

最后,重啟httpd使改動生效。

 

 
  1. $ sudo service httpd restart  

測試phpMyAdmin

測試phpMyAdmin是否設置成功,訪問這個頁面:http:///phpmyadmin

在CentOS上安裝phpMyAdmin的教程

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 峨山| 高淳县| 阿勒泰市| 邛崃市| 子长县| 霍州市| 固原市| 英超| 鸡西市| 全南县| 天门市| 六盘水市| 宁强县| 江川县| 巴塘县| 沙坪坝区| 若尔盖县| 淄博市| 治多县| 建阳市| 平罗县| 大化| 德州市| 顺义区| 如东县| 乌拉特前旗| 邻水| 兴文县| 雷山县| 石台县| 富裕县| 景洪市| 黔西县| 平邑县| 阜康市| 凤翔县| 辽源市| 罗源县| 星座| 华亭县| 和静县|