很久以前安装过,本来以为5分钟可以解决的问题,最终研究了一上午,主要原因是php版本的问题,这个没有注意到,需要使用最新的php7版本。

​https://www.phpmyadmin.net/​​​​

下载phpmyadmin

phpMyAdmin-5.1.2-all-languages.zip


# cat /etc/redhat-release

CentOS Linux release 7.7.1908 (Core)


需要使用最新版本的php,确认没有安装php,如有,请卸载

# rpm -qa |grep php

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

# php -v


# yum install httpd unzip


解压

# unzip phpMyAdmin-5.1.2-all-languages.zip -d /var/www/html

# cd /var/www/html/

# mv phpMyAdmin-5.1.2-all-languages/ phpmyadmin

# cd phpmyadmin/

# cp config.sample.inc.php config.inc.php


配置多个主机的数据库访问,并配置cookie的加密字符串,可以使用openssl rand -base64 32随机生成

# vi config.inc.php

$cfg['blowfish_secret'] = 'VDIDF98ca3ucSuV1OUuPsyo5U90QIZmNTLeKWmQytRE=';

/**

* Servers configuration

*/

$i = 0;


/**

* First server

*/

$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */

$cfg['Servers'][$i]['host'] = '192.168.49.137';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['AllowNoPassword'] = false;


/**

* Second server

*/

$i++;

/* Authentication type */

$cfg['Servers'][$i]['auth_type'] = 'cookie';

/* Server parameters */

$cfg['Servers'][$i]['host'] = '192.168.49.138';

$cfg['Servers'][$i]['compress'] = false;

$cfg['Servers'][$i]['AllowNoPassword'] = false;


启动web服务

# systemctl enable httpd

# systemctl start httpd


浏览器访问,其中用户名密码是mysql数据库的用户名密码

​http://192.168.49.139/phpmyadmin/​​​​

phpMyAdmin 5.1安装_phpmyadmin