首頁  >  文章  >  資料庫  >  如何使用yum安裝phpmyadmin

如何使用yum安裝phpmyadmin

尚
原創
2019-12-09 10:53:453031瀏覽

如何使用yum安裝phpmyadmin

在安裝好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

# yum install --enablerepo=remi --enablerepo=remi-php56 phpmyadmin

(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/>
   Order Deny,Allow
   #Deny  from All
   Allow from All
</Directory>

(4)用指令/etc/init.d/httpd restart重啟Apache。

可能會出現以下問題:

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後再試試。

更多phpmyadmin相關技術文章,請造訪phpmyadmin教學專欄!

以上是如何使用yum安裝phpmyadmin的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn