mysql管理工具-phpMyAdmin搭建步驟

來源:互聯網
上載者:User

標籤:密碼檔案   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搭建步驟

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.