首先服務器要有web 環境
yum install phpmyadmin
有時候會安裝不成功,提示沒有可用軟件包,則需要安裝Remi源
# yum install epel-release # rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
修改/etc/http.conf/conf.d/phpMyadmin.conf
將 #Require ip 127.0.0.1 #Require ip ::1 注釋
添加Require all granted
即可在瀏覽器通過ip/phpmyadmin 訪問
我的服務器為centos7.2
文檔截圖
修改/etc/phpMyAdmin/config.inc.php:
$cfg['PmaAbsoluteUri']='http://localhost/phpmyadmin'; //將該參數的值設定為phpMyAdmin所處的位置。 $cfg['Servers'][$i]['host'] = 'localhost'; //設定MySQL所在的主機名或IP地址。如127.0.0.1這步很重要 $cfg['Servers'][$i]['auth_type'] = 'cookie'; // 設定進入phpMyAdmin管理MySQL的方式,共有三個選項:config、http、cookie。config是按配置文件登錄,為默認方式, 無需任何確認;http是使用HTTP登錄管理,在Apache模塊安裝下才能支持;cookie是最通用的管理方式。后兩種方式的用戶名和密碼都是直接到數據庫中驗證。 $cfg['Servers'][$i]['user'] = 'root' ; //設定管理MySQL的賬號。 $cfg['Servers'][$i]['password'] = '' ; //設定管理MySQL的密碼。 要是你想用空密碼 把配置中的$cfg['Servers'][$i]['AllowNoPassword'] = false; 改成 $cfg['Servers'][$i]['AllowNoPassword'] = true;
設 置完成后,保存config.inc.php文件,重啟Apache,測試:訪問http://ip地址/phpMyAdmin/
各linux版本重啟apache命令 Slackware Linux命令: /etc/rc.d/rc.httpd restart ubuntu、Debian 系統命令: /etc/init.d/apache2 restart Fedora 、Redhat、CentOS系統重啟Apache命令: /etc/init.d/httpd restart 或 service httpd restart(CentOS 成功)
