Centos6.5: Apache+phpadmin+mysql5.7 搭建
一、安装httpd
yum install httpd
vim /etc/httpd/conf/httpd.conf
末尾添加 ServerName IP:80
service httpd start (检查防火墙,浏览器访问,检查是否可以访问)
二、安装PHP
yum install php
cd /var/www/html 编写测试文件 info.php
vim info.php 添加
phpinfo()
?>
浏览器访问( http://IP/info.php) 出现PHP模块页面
让php在mysql中获得支持,我们需要安装php-mysql软件包。(需注意php版本与数据库版本,php>=mysql)
1.检查当前安装的PHP包
yum list installed | grep php
2.如果安装的PHP包,先删除他们
yum remove
CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

三、mysql5.7安装
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
rpm -Uvh mysql57-community-release-el6-9.noarch.rpm
yum -y install mysql-community-server
软链(将/var/lib/mysql 软连接到磁盘较大的目录)
service mysqld start(/bin/bash /etc/init.d/mysqld start)
grep 'temporary password' /var/log/mysqld. fenxi2015tlkg
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON . TO root@"%" IDENTIFIED BY '' WITH GRANT OPTION;

四、官网下载PHPAdmin包
https://www.phpmyadmin.net/downloads/
下载之后解压到 /var/www/html 并改名 phpadmin
cd /var/www/html/phpadmin
cp config.sample.inc.php config.inc.php (拷贝配置文件)

vim  config.inc.php    添加 
          /**多个数据库*/
                $connect_hosts = array(
                  '1'=>array(
                    "host"   => "172.18.12.123",  //本地服务器
                    "user"   => "root",
                    "password" => ""
                  ),
                  '2' => array(
                    "host"   => "172.18.10.123", //服务器1
                    "user"   => "summer",
                    "password" => ""
                   ),
                  '3' => array(
                    "host"   => "172.18.11.123", //服务器1
                    "user"   => "root",
                    "password" => ""
                   )
                  );

                for ($i=1;$i<=count($connect_hosts);$i++) {

                  /* Authentication type */
                  $cfg['Servers'][$i]['auth_type'] = 'cookie';
                  /* Server parameters */
                  $cfg['Servers'][$i]['host'] = $connect_hosts[$i]['host'];   //修改host
                  $cfg['Servers'][$i]['connect_type'] = 'tcp';
                  $cfg['Servers'][$i]['compress'] = false;
                  /* Select mysqli if your server has it */
                  $cfg['Servers'][$i]['extension'] = 'mysql';
                  $cfg['Servers'][$i]['AllowNoPassword'] = true;
                  $cfg['Servers'][$i]['user'] = $connect_hosts[$i]['user'];  //修改用户名
                  $cfg['Servers'][$i]['password'] = $connect_hosts[$i]['password']; //密码
                  /* rajk - for blobstreaming */
                  $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';
                }
重启httpd,浏览器访问 http://IP/phpMyAdmin 

五、登录成功后页面出现的问题:
(1) 短语密码密码问题
在config.inc.php文件中找到$cfg['blowfish_secret'] = '' ";这行,在单引号里面随便输入字符串。 (最新版本phpadmin,最少输入32位)
(2)tmp 目录,缓存慢问题
在 /var/www/html/phpadmin 创建 tmp 目录 并 授权777 权限。
重启httpd 再次访问。