首頁  >  文章  >  資料庫  >  詳解phpMyAdmin怎麼搭建多資料庫伺服器

詳解phpMyAdmin怎麼搭建多資料庫伺服器

藏色散人
藏色散人轉載
2021-08-20 14:52:123854瀏覽

本文將由phpmyadmin教學專欄為大家介紹phpMyAdmin搭建及管理多台資料庫伺服器的方法,希望對需要的朋友有幫助!

phpMyAdmin建置及管理多台資料庫伺服器

環境說明:

系统版本    CentOS 6.9 x86_64        
软件版本    nginx-1.12.2        php-5.5.38        phpMyAdmin 4.8.0.1

1、phpMyAdmin介紹

phpMyAdmin 是一個以PHP為基礎,以Web -Base方式架構在網站主機上的MySQL的資料庫管理工具,讓管理者可用Web介面管理MySQL資料庫。藉由此Web介面可以成為一個簡易方式輸入繁雜SQL語法的較佳途徑,尤其要處理大量資料的匯入及匯出更為方便。其中一個更大的優點在於因為phpMyAdmin跟其他PHP程式一樣在網頁伺服器上執行,但您可以在任何地方使用這些程式產生的HTML頁面,也就是遠端管理MySQL資料庫,方便的建立、修改、刪除資料庫及資料表。也可藉由phpMyAdmin建立常用的php語法,方便編寫網頁時所需的sql語法正確性。

官網:https://www.phpmyadmin.net

2、安裝phpMyAdmin的環境需求

3、步驟

3.1、編譯安裝nginx和php可以參考前面的博文,這裡不再贅述,但基於phpMyAdmin的環境需求,編譯php的時候所採用的編譯參數是:

./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配置文件,重命名預設的phpMyAdmin設定檔cp config.sample.inc.php config.inc. php

3.3、建立資料庫並進行創庫授權(參考前面的部落格文章)

3.4、瀏覽器存取登入

4 、設定phpMyAdmin管理多台資料庫伺服器

以10.0.0.51和10.0.0.52為例

4.1 在10.0.0.52上安裝mysql

設定密碼,登入mysql

[root@db02 mysql]# mysql -uroot -p123456

授權資料庫給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  
复制粘贴并修改  
$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資料庫。

以上是詳解phpMyAdmin怎麼搭建多資料庫伺服器的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:cnblogs.com。如有侵權,請聯絡admin@php.cn刪除