apache安装phpMyAdmin

安装phpMyAdmin

我这里是LAMP环境

  1. 安装httpd,和phpMyAdmin,数据库可以yum安装看你自己情况选择安装方式
$ yum -y install httpd phpMyAdmin php
  1. 修改apache的配置
$  vim /etc/httpd/conf.d/phpMyAdmin.conf

将文件中所有的127.0.0.1用本地的ip替换,如:

<RequireAny>
       Require ip xx.xx.xx.xx(你所在位置的公网ip)
       Require ip ::1
</RequireAny>

可以使用sed -i 's#127.0.0.1#这里是替换成什么ip#g' /etc/httpd/conf.d/phpMyAdmin.conf

  1. 修改apache配置后,重启httpd服务,如果只需要访问本地的数据库,到此就完成了。
  2. 如果需要配置访问其他非本地的数据库,修改phpmyadmin配置文件
$ vim /etc/phpMyAdmin/config.inc.php

在server configuration部分的最后,添加如下内容:

$i++;
$cfg['Servers'][$i]['verbose'] = '(db name)';
$cfg['Servers'][$i]['host'] = '(db host)';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
原文地址:https://www.cnblogs.com/blsnt/p/10179792.html