在安裝好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的源义矛。
# 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 /usr/share/phpMyAdmin/>
OrderDeny,Allow
#Deny? from All
Allow from All
</Directory>
(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選項然后選擇常規(guī)司忱,刪除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導入剛剛創(chuàng)建的數據庫phpmyadmin內:use phpmyadmin
source /usr/share/phpMyAdmin/sql/create_tables.sql
d.訪問phpMyAdmin鳍烁,如果還是不行,重啟Apache后再試試繁扎。