環(huán)境:centos6.9 mysql5.7(community) httpd phpmyadmin(4.7.7)
檢查mysql,httpd和phpmyadmin是否安裝
[root@local ~]# rpm -qa | grep mysql
mysql-community-common-5.7.21-1.el6.i686
mysql-community-libs-5.7.21-1.el6.i686
mysql-community-client-5.7.21-1.el6.i686
mysql-community-server-5.7.21-1.el6.i686
[root@local ~]# rpm -qa | grep httpd
httpd-tools-2.2.15-60.el6.centos.6.x86_64
httpd-2.2.15-60.el6.centos.6.x86_64
[root@local ~l]# rpm -qa | grep phpmyadmin
[root@local ~]#
安裝httpd
安裝mysql(參考這篇文章http://www.reibang.com/p/5cf4970c56b7)
安裝phpmyadmin
這里只詳細寫下安裝phpmyadmin的過程
[root@local ~]# wget https://files.phpmyadmin.net/phpMyAdmin/4.7.7/phpMyAdmin-4.7.7-all-languages.zip
解壓
[root@local ~]# unzip phpMyAdmin-4.7.7-all-languages.zip
復(fù)制文件到http的目錄下
[root@local ~]# mkdir /var/www/html/phpmyadmin
[root@local ~]# cp -rf * /var/www/html/phpmyadmin/
先測試httpd服務(wù)是否能夠訪問
在/va r/www/html 下面新建index.html 內(nèi)容為test 然后重啟httpd
[root@local html]# touch index.html
[root@local html]#
[root@local html]# vim index.html
[root@local html]# service httpd restart
停止 httpd: [確定]
正在啟動 httpd:httpd: apr_sockaddr_info_get() failed for local
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [確定]
[root@local html]#
在虛擬機外部訪問虛擬機centos的ip地址
1谷徙,確保80端口對外開放
2,確保防火墻規(guī)則允許目的端口為80的入站
[root@local html]#
[root@local html]# cd /etc/sysconfig/
[root@local sysconfig]# vim iptables
[root@local sysconfig]#
[root@local sysconfig]#
[root@local sysconfig]#
[root@local sysconfig]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@local sysconfig]# service iptables save
iptables:將防火墻規(guī)則保存到 /etc/sysconfig/iptables: [確定]
[root@local sysconfig]# service iptables restart
iptables:將鏈設(shè)置為政策 ACCEPT:filter [確定]
iptables:清除防火墻規(guī)則: [確定]
iptables:正在卸載模塊: [確定]
iptables:應(yīng)用防火墻規(guī)則: [確定]
[root@local sysconfig]#
[root@local sysconfig]#
[root@local sysconfig]#
[root@local sysconfig]#
[root@local sysconfig]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1276/sshd
tcp 0 0 :::3306 :::* LISTEN 2382/mysqld
tcp 0 0 :::80 :::* LISTEN 2729/httpd
tcp 0 0 :::22 :::* LISTEN 1276/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1119/dhclient
udp 0 0 0.0.0.0:847 0.0.0.0:* 1200/portreserve
udp 0 0 0.0.0.0:647 0.0.0.0:* 1200/portreserve
[root@local sysconfig]#
配置并備份config.sample.inc.php文件
[root@local phpmyadmin]# cp config.sample.inc.php config.inc.php
注意config.sample.inc.php文件是配置備份文件起作用的是config.inc.php
配置如下(40行)
/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = '3306';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '此處填寫mysql密碼';
然后訪問ip/phpmyadmin/index.php
輸入mysql的用戶名和密碼登錄
可能出現(xiàn)的問題:
1,確保web環(huán)境完整(mysql+httpd+php)
2侮繁,確保php有mysql擴展
如何查看php信息:
/var/www/html下
touch index.php
內(nèi)容如下:
<?php
echo phpinfo();
然后外部訪問ip/index.php來查看php的信息