1.下載
http://www.phpmyadmin.net/
進入之後有download按鈕,點選導航欄的Download連結,進入下載介面,這裡下載最新版的 phpMyAdmin 4.9.2
2.下載下來上傳到伺服器上,然後執行下面命令解壓:
tar -xvzf phpMyAdmin-4.9.2-all-languages.tar.gz
3.移動到網站可存取地址(網站根目錄)下
mv phpMyAdmin-4.9.2-all-languages /var/www/
4.重新命名資料夾(phpMyAdmin-4.9.2-all-languages)為 phpmyadmin
5.這時候可以看到目錄下有一個組態檔:config.sample.inc.php,將這個檔案拷貝一份成config.inc.php
cp config.sample.inc.php config.inc.php
然後執行編輯:
vim config.inc.php
找到$cfg['blowfish_secret']設定項,後面預設為空,這裡我們可以隨便設定一個複雜的字串,用來加密使用;
然後$cfg['Servers'][$i]['auth_type']這一項預設為cookie,表示每次都要登入,我們不用修改,這樣比較安全;
然後$cfg['Servers'][$i]['host'] = '127.0.0.1';這裡修改成自己資料庫連結地址
$cfg['blowfish_secret'] = '隨便設定一個複雜的字串'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *//** * Servers configuration */$i = 0;/** * First server */$i++;/* Authentication type */$cfg['Servers'][$i]['auth_type'] = 'cookie';/* Server parameters */$cfg['Servers'][$i]['host'] = '資料庫host地址'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false;
如下:
6.設定nginx
server { client_max_body_size 20M; listen 80; server_name 47.**.**.230; set $root_path '/var/www/phpmyadmin'; root $root_path; index index.php index.html index.htm; try_files $uri $uri/ @rewrite; location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
重新啟動nginx
service nginx restart
7.存取
以上就是linux怎麼安裝phpmyadmin的詳細內容,更多請關注TW511.COM其它相關文章!