当前位置: 代码迷 >> 综合 >> phpmyadmin 简易安装后的配置
  详细解决方案

phpmyadmin 简易安装后的配置

热度:28   发布时间:2024-01-08 23:46:30.0

yum install phpmyadmin

phpmyadmin支持apache的配置文件路径:

/etc/httpd/conf.d/phpMyAdmin.conf

 

配置内容:

# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1 注释掉
#Require ip ::1 注释掉
Require all granted #新加运行远程访问
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1 注释掉
#Require ip ::1 注释掉
Require all granted #新加运行远程访问
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>

如果要连接远程数据库:

配置文件路径

/etc/phpMyadmin/config.inc.php

// 把host 主机有本地访问改成由远程访问。

把 $cfg['Servers'][$i]['host'] = 'localhost'; 改为 $cfg['Servers'][$i]['host'] = '127.0.0.1';

 

 

.默认安装php目录:/usr/share/phpMyAdmin/

可能的坑:版本不够新。

  相关解决方案