本文將由phpmyadmin教程欄目給大家介紹phpMyAdmin搭建及管理多臺數(shù)據(jù)庫服務(wù)器的方法,希望對需要的朋友有所幫助!
phpMyAdmin搭建及管理多臺數(shù)據(jù)庫服務(wù)器
環(huán)境說明:
系統(tǒng)版本 CentOS 6.9 x86_64 軟件版本 nginx-1.12.2 php-5.5.38 phpMyAdmin 4.8.0.1
1、phpMyAdmin介紹
phpMyAdmin 是一個以PHP為基礎(chǔ),以Web-Base方式架構(gòu)在網(wǎng)站主機(jī)上的MySQL的數(shù)據(jù)庫管理工具,讓管理者可用Web接口管理MySQL數(shù)據(jù)庫。借由此Web接口可以成為一個簡易方式輸入繁雜SQL語法的較佳途徑,尤其要處理大量資料的匯入及匯出更為方便。其中一個更大的優(yōu)勢在于由于phpMyAdmin跟其他PHP程式一樣在網(wǎng)頁服務(wù)器上執(zhí)行,但是您可以在任何地方使用這些程式產(chǎn)生的HTML頁面,也就是于遠(yuǎn)端管理MySQL數(shù)據(jù)庫,方便的建立、修改、刪除數(shù)據(jù)庫及資料表。也可借由phpMyAdmin建立常用的php語法,方便編寫網(wǎng)頁時所需要的sql語法正確性。
官網(wǎng):https://www.phpmyadmin.net
2、安裝phpMyAdmin的環(huán)境要求
3、步驟
3.1、編譯安裝nginx和php可以參照前面的博文,這里不再贅述,但是基于phpMyAdmin的環(huán)境要求,編譯php的時候采用的編譯參數(shù)是:
./configure --prefix=/application/php5.5.38 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64/ --with-curl --enable-fpm --enable-mbstring --with-gd --with-fpm-user=nginx --with-fpm-group=nginx --with-mysqli=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-openssl --enable-zip
3.2、配置phpMyAdmin
將下載的phpmyadmin源碼包放到nginx的站點根目錄即html目錄下,解壓并修改nginx配置文件,重命名默認(rèn)的phpMyAdmin配置文件cp config.sample.inc.php config.inc.php
3.3、搭建數(shù)據(jù)庫并進(jìn)行創(chuàng)庫授權(quán)(參照前面的博文)
3.4、瀏覽器訪問登入
4、配置phpMyAdmin管理多臺數(shù)據(jù)庫服務(wù)器
以10.0.0.51和10.0.0.52為例
4.1 在10.0.0.52上安裝mysql
設(shè)置密碼,登錄mysql
[root@db02 mysql]# mysql -uroot -p123456
授權(quán)數(shù)據(jù)庫給10.0.0.51
mysql> grant all on *.* to root@'10.0.0.51' identified by '123456';
4.2 配置安裝了phpMyAdmin的db01
vim /application/nginx/html/phpMyAdmin-4.8.0.1-all-languages/config.inc.php 復(fù)制粘貼并修改 $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = '10.0.0.52'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false;
刷新頁面即可登錄到10.0.0.52數(shù)據(jù)庫。