首先服务器要有web 环境
yum install phpmyadmin
有时候会安装不成功,提示没有可用软件包,则需要安装Remi源
在安装好Apache、MySQL、PHP后,使用Remi源可以安装phpMyAdmin最新版本。
安装Remi源
CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS 7.0-7.2的源。
# yum install epel-release
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
再次执行安装phpMyAdmin
# yum install phpmyadmin
修改/etc/http.conf/conf.d/phpMyadmin.conf
#Require ip 127.0.0.1 #Require ip ::1 //注释掉
添加 Require all granted

即可在浏览器通过ip/phpmyadmin 访问
修改/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; // 空密码配置 把false 改成 true $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