1,在CentOS7安裝epel源,(原服務器上要有php環境以及php的進程管理器php-fpm)
yum -y install epel-releasephp
2,安裝phpMyAdmin軟件
yum -y install phpmyadmin html
3,爲了使Nginx Web服務器正確地查找和提供phpMyAdmin文件,咱們只須要建立一個從安裝文件到咱們的Nginx文檔根目錄的符號連接:
ln -s /usr/share/phpMyAdmin /usr/share/nginx/htmlmysql
4,配置nginx,以下圖
nginx
5,從新啓動咱們的PHP處理器,以確保它能夠加載咱們安裝的額外的PHP模塊:
systemctl restart php-fpmsql
6,這樣,咱們的phpMyAdmin安裝如今能夠運行。 要訪問該界面中,轉至服務器的域名或公網IP地址,後跟/phpMyAdmin ,在網頁瀏覽器
http://server_domain_or_IP/phpMyAdmin數據庫
7,咱們能夠受權咱們的mysql數據庫服務器對外遠程訪問
登陸mysql數據庫
msyql -uyourusername -pyoupassword
mysql > grant all privileges on . to yourMysqlUser@'%' identified by 'your password';
mysql > flush privileges;
mysql > exit;centos
8,測試並驗證瀏覽器
9,如果有多個須要鏈接的數據庫,能夠修改phpMyAdmin的配置文件,修改根目錄/etc/phpMyAdmin中的config.inc.php配置
$i = 0;服務器
/*dom
- 服務器A
/
$i++;
/ Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/*
- 服務器B
*/
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3308';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ‘123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/*
- 服務器C
*/
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
保存,打開phpmyadmin,在首頁就能夠看到服務器列表了
10,可參考內容以下
https://www.howtoing.com/how-to-install-and-secure-phpmyadmin-with-nginx-on-a-centos-7-server