phpmyadmin工具安装(CentOS7\phpMyAdmin4.8.5 )
Linux: centos7
phpmyadmin: 4.8.5
地址:https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip
php: 5.6
【防火墙关闭】
######关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
######关闭SELinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
cat /etc/selinux/config
安装:
yum -y install httpd
systemctl enable httpd ##开机启动
systemctl start httpd ##启动
将phpmyadmin 放置在/var/www/html目录下.(前提安装了httpd)
1、打开phpMyAdmin/libraries/config.default.php文件进行编辑
vim /var/www/html/phpmyadmin/libraries/config.default.php
$cfg['PmaAbsoluteUri'] = 'http://ip/phpmyadmin';//填写phpmyadmin的访问网址
$cfg['Servers'][$i]['host'] = 'mysql服务器ip'; // 需要访问的mysql host
$cfg['Servers'][$i]['port'] = ''; // mysql端口,如果是默认3306,保留为空即可
$cfg['Servers'][$i]['user'] = 'root'; // mysql用户名
$cfg['Servers'][$i]['password'] = ''; // MySQL password
$cfg['Servers'][$i]['auth_type'] = 'cookie'; //认证方式(推荐cookie。本人重试http发现访问直接打印了php的源代码,醉醉的)
配置完成后,直接web访问即可
http://ip/phpmyadmin/index.php
如果无法访问查看下是否有PHP: php -v
其它问题(php版本过低、配置多数据源)
#1、如果访问出现下面的情况。是linux中php版本低了。
PHP 5.5+ is required.
Currently installed version is: 5.4.16
查看php版本:php -v
=====================
如下是php升级方式。需要谨慎操作(不然其它php应用将无法使用)
升级软件仓库
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
删除php
yum remove php-common
安装php 5.6版本
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-fpm
重启
service httpd restart
查看
php -v
#service php-fpm start
#service nginx restart
#2、phpmyadmin中配置mysql,多数据源
cd /var/www/html/phpmyadmin
##重命名
mv config.sample.inc.php config.inc.php
vim config.inc.php
################### 注释并添加代码 ########################################################
/**
* Servers configuration
*/
//$i = 0;
/**
* First server
*/
//$i++;
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['compress'] = false;
//$cfg['Servers'][$i]['AllowNoPassword'] = false;
$connect_hosts = array(
'1'=>array(
"host"=> "服务器ip",//服务器
"port"=> "3306", //服务器
"user"=> "用户",
"password" => "密码"
),
'2' => array(
"host"=> "服务器ip", //服务器
"port"=> "3306", //服务器
"user"=> "用户",
"password" => "密码"
),
'3' => array(
"host"=> "服务器ip", //服务器
"port"=> "3306", //服务器
"user"=> "用户",
"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']; //密码
$cfg['Servers'][$i]['port'] = $connect_hosts[$i]['port']; //端口
/* 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';
}
###########################################################################
修改完成
service httpd restart
重新web访问。