欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在CentOS上安裝phpMyAdmin的教程

 更新時(shí)間:2015年06月17日 11:57:07   投稿:goldensun  
這篇文章主要介紹了在CentOS上安裝phpMyAdmin的教程,phpMyAdmin是一款借助PHP腳本來操作MySQL的工具,非常具有人氣,需要的朋友可以參考下

前提

在CentOS上安裝phpMyAdmin,你第一步需要架設(shè)一臺(tái)Web服務(wù)器(如Apache或nginx),安裝好MySQL/MariaDB數(shù)據(jù)庫(kù)和PHP。根據(jù)你的偏好和需求,你可以從LAMPLEMP中選擇一種安裝。

另一個(gè)要求是允許在你的CentOS上安裝EPEL庫(kù)。如果你還沒設(shè)置過請(qǐng)猛戳這里。
在CentOS6或7上安裝phpMyAdmin

一旦你設(shè)置了EPEL庫(kù),你就能輕松地用以下命令安裝phpMyAdmin了。

在CentOS 7上:

  $ sudo yum install phpmyadmin 

在CentOS 7上:

  $ sudo yum install phpmyadmin php-mcrypt 

在CentOS 7上配置phpMyAdmin

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

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

  $ 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使改動(dòng)生效。

  $ sudo systemctl restart httpd 

在CentOS 6上配置phpMyAdmin

默認(rèn)情況下,CentOS 6上的phpMyAdmin是禁止從每個(gè)IP地址訪問的。為了能遠(yuǎn)程連接,你需要改動(dòng)它的配置。

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

  $ sudo vi /etc/httpd/conf.d/phpmyadmin.conf 

  <Directory "/usr/share/phpmyadmin">
   Order Deny,Allow
  # Deny from all
   Allow from 0.0.0.0
  </Directory>

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

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

  $ sudo vi /usr/share/phpmyadmin/config.inc.php 

  $cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

最后,重啟httpd使改動(dòng)生效。

  $ sudo service httpd restart 

測(cè)試phpMyAdmin

測(cè)試phpMyAdmin是否設(shè)置成功,訪問這個(gè)頁面:http://<web-server-ip-addresss>/phpmyadmin

2015617115413084.jpg (640×484)

相關(guān)文章

最新評(píng)論