在安裝好Apache、MySQL、PHP后,使用Remi源可以安裝phpMyAdmin最新版本。
(1)安裝Remi源
CentOS 6.5的epel及remi源。
#?rpm?-Uvh?http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm #?rpm?-Uvh?http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS 7.0的源。
立即學習“PHP免費學習筆記(深入)”;
#?yum?install?epel-release #?rpm?-ivh?http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
(2)安裝phpMyAdmin
#?yuminstall--enablerepo=remi--enablerepo=remi-php56phpmyadmin
(3)配置phpMyAdmin
a.修改/etc/phpMyAdmin/config.inc.php:
打開config.inc.php文件,進行以下修改:
//?$cfg['Servers'][$i]['controluser']?=?'pma'; //?$cfg['Servers'][$i]['controlpass']?=?'pmapass'; //?$cfg['Servers'][$i]['pmadb']?=?'phpmyadmin'; //?$cfg['Servers'][$i]['bookmarktable']?=?'pma_bookmark'; //?$cfg['Servers'][$i]['relation']?=?'pma_relation'; //?$cfg['Servers'][$i]['table_info']?=?'pma_table_info'; //?$cfg['Servers'][$i]['table_coords']?=?'pma_table_coords'; //?$cfg['Servers'][$i]['pdf_pages']?=?'pma_pdf_pages'; //?$cfg['Servers'][$i]['column_info']?=?'pma_column_info'; //?$cfg['Servers'][$i]['history']?=?'pma_history'; 去掉每行前面的// $cfg['blowfish_secret']?=?'';修改為$cfg['blowfish_secret']?=?'config'; $cfg['Servers'][$i]['controluser']?='pma';把pma修改為你的帳號 $cfg['Servers'][$i]['controlpass']?='pmapass';把pmapass設置為你的mysql登錄密碼 $cfg['blowfish_secret']?='';添加短語密碼,可是任意字符串例如:$cfg['blowfish_secret']?=?'abcd'修改以后, 以后登入phpMyAdmin就方便多了,但一定不要使用空密碼。
b.修改/etc/httpd/conf.d/phpMyAdmin.conf
本文件是phpMyAdmin的訪問控制文件,保證遠程訪問。如下修改即可:
<directory></directory> OrderDeny,Allow #Deny??from?All Allow?from?All
(4)用命令/etc/init.d/httpd restart重啟Apache,測試:訪問http://ip地址/phpMyAdmin/
可能會出現以下問題:
1.如果安裝php時沒有安裝php-mcrypt包,可能會出現錯誤提示,這時只需將其安裝:
yum?-y?install?php-mcrypt
2.phpMyAdmin訪問被拒絕
將config.inc文件中$cfg[‘Servers’][$i][‘auth_type’] = ‘config’;的config改為http,重啟Apache,訪問http://ip地址/phpMyAdmin/時將彈出一個對話框,可以輸入用戶名和密碼,來進入phpMyAdmin。
3.如果經過以上兩個步驟的修改,依然提示你phpMyAdmin拒絕訪問,那么很可能是cookie惹的禍,打開瀏覽器,選擇工具,點擊internet選項然后選擇常規,刪除cookie。再訪問http://ip地址/phpMyAdmin/。
(5)成功登錄phpMyAdmin后,若提示”Configuration of pmadb…錯誤”,則進行以下操作:
a.命令行登錄mysql:
mysql?-uroot?-p
b.新建一個名稱為phpmyadmin的數據庫:
CREATE?DATABASE?phpmyadmin
c.將PHPMyAdmin安裝目錄下sql目錄內的create_tables.sql導入剛剛創建的數據庫phpmyadmin內:
use?phpmyadmin
source?/usr/share/phpMyAdmin/sql/create_tables.sql
d.訪問phpMyAdmin,如果還是不行,重啟Apache后再試試。
PHP中文網,有大量免費的phpmyadmin入門教程,歡迎大家學習!