標籤:密碼檔案 txt 改名 ima inf ati 分享 class 輸入密碼
phpMyAdmin搭建步驟
提示:該環境需要在lnmp或者lamp環境前提下進行搭建
1.下載源碼包
wget https://files.phpmyadmin.net/phpMyAdmin-4.6.4-all-languages.tar.gz
2.將該源碼包解壓至網站根目錄
[[email protected]:~]$tar -xvzf phpMyAdmin-4.6.4-all-languages.tar.gz -C /data/www/
3.改名
[[email protected]:~]$mv phpMyAdmin-4.6.4-all-languages phpMyAdmin
4.修改設定檔(可以根據資料庫的台數進行模組的添加)
[[email protected]:~]$cd /data/www/phpMyAdmin
[[email protected]:~]$ cp config.sample.inc.php config.inc.php
[[email protected]:~]$vim config.inc.php
/**
* First server
*/
$i++;
$cfg[‘Servers‘][$i][‘verbose‘] = ‘一組‘;
$cfg[‘Servers‘][$i][‘host‘] = ‘192.168.1.1‘; #資料庫ip地址
$cfg[‘Servers‘][$i][‘port‘] = ‘‘;
$cfg[‘Servers‘][$i][‘socket‘] = ‘‘;
$cfg[‘Servers‘][$i][‘connect_type‘] = ‘tcp‘;
$cfg[‘Servers‘][$i][‘extension‘] = ‘mysqli‘;
$cfg[‘Servers‘][$i][‘auth_type‘] = ‘cookie‘;
$cfg[‘Servers‘][$i][‘user‘] = ‘admin‘;
$cfg[‘Servers‘][$i][‘password‘] = ‘複雜型密碼‘;
$cfg[‘Servers‘][$i][‘AllowRoot‘] = false;
$cfg[‘Servers‘][$i][‘hide_db‘] = ‘information_schema|mysql|performance_schema|test‘;
$i++;
$cfg[‘Servers‘][$i][‘verbose‘] = ‘二組‘;
$cfg[‘Servers‘][$i][‘host‘] = ‘192.168.1.2‘; #資料庫ip地址
$cfg[‘Servers‘][$i][‘port‘] = ‘‘;
$cfg[‘Servers‘][$i][‘socket‘] = ‘‘;
$cfg[‘Servers‘][$i][‘connect_type‘] = ‘tcp‘;
$cfg[‘Servers‘][$i][‘extension‘] = ‘mysqli‘;
$cfg[‘Servers‘][$i][‘auth_type‘] = ‘cookie‘;
$cfg[‘Servers‘][$i][‘user‘] = ‘admin‘;
$cfg[‘Servers‘][$i][‘password‘] = ‘複雜型密碼‘;
$cfg[‘Servers‘][$i][‘AllowRoot‘] = false;
$cfg[‘Servers‘][$i][‘hide_db‘] = ‘information_schema|mysql|performance_schema|test‘;
/**
* phpMyAdmin configuration storage settings.
*/
5.搭建完成
6.進行測試
http://網域名稱/phpMyAdmin
此處的訪問連結和上面修改的phpmyadmin的解壓目錄的名稱相關聯
7.至此phpmyadmin安裝完成
二、htpasswd帳號建立和回收
8.Nginx訪問限制設定
9.進入nginx的設定檔
添加
location / {
auth_basic "Please Input Password...";
auth_basic_user_file /usr/local/nginx/conf/htpasswd/zb;
}
10.建立驗證登入的賬戶和密碼
1、cd /usr/local/nginx/conf/
mkdir htpasswd
cd htpasswd
touch pma.txt
htpasswd -b -c pma.txt 賬戶 密碼
{
參數解釋:
-b 表示在htpassswd命令列中一併輸入使用者名稱和密碼而不是根據提示輸入密碼
-c 表示建立一個新的加密檔案
}
用上面的命令建立的賬戶的加密資訊會寫入建立的加密檔案pma.txt中
2、在同一個密碼檔案中建立一個新的使用者
htpasswd -b pma.txt 帳號 密碼
11.帳號回收
Htpasswd -D pma.txt 帳號
12.重新登入
http://phpMyAdmin
此處會讓你輸入驗證的帳號和密碼才會進入phpmyadmin登入介面
mysql管理工具-phpMyAdmin搭建步驟