现在的位置: 首页 > 综合 > 正文

PhpMyAdmin (简体中文)

2018年02月07日 ⁄ 综合 ⁄ 共 4597字 ⁄ 字号 评论关闭

From ArchWiki

 

Contents

准备

按照 LAMP
wiki 所说的方法安装apache, php 和 mysql。

安装

运行下面的命令安装 phpMyAdmin

#pacman -S phpmyadmin php-mcrypt

配置

如果已经安装过老版本的phpmyadmin,请先删除:

rm -r /srv/httpd/phpMyAdmin

复制配置文件到你的httpd的配置文件目录

cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf

将下面这行添加到 /etc/httpd/conf/httpd.conf:

Include conf/extra/httpd-phpmyadmin.conf

或者,在命令行执行下面的命令也是相同的结果:

echo -e "/nInclude conf/extra/httpd-phpmyadmin.conf" >> /etc/httpd/conf/httpd.conf

编辑/usr/share/webapps/phpMyAdmin/.htaccess,像下面这样注释掉(或者删除)'deny form
all':

#deny from all

否则在访问phpmyadmin installation时,会返回错误信息"Error 403 - Access forbidden!"。

'/etc/httpd/conf/extra/httpd-phpmyadmin.conf'中应该包含了下面这些信息:

Alias /phpmyadmin/ "/usr/share/webapps/phpMyAdmin/"
<Directory "/usr/share/webapps/phpMyAdmin">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>

打开'/etc/php/php.ini',编辑'open_basedir'这行,将下面的路径补充在后面:

:/usr/share/webapps/:/etc/webapps

例如,像下面这个样子:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/srv/:/usr/share/webapps/:/etc/webapps

phpmyadmin需要PHP的mcrypt模块支持,编辑/etc/php/php.ini
的:

 ;extension=mcrypt.so
取消前面的注释
 extension=mcrypt.so

访问 phpmyadmin 安装

通过浏览器访问下面的链接,完成phpmyadmin安装:

http://localhost/phpmyadmin/
或者
http://localhost/phpmyadmin/index.php

注意: 'localhost' 是/etc/rc.conf文件中你配置的主机名.

如果你希望像下面这样,不需要最后的/访问phpmyadmin:

http://localhost/phpmyadmin

需要将 '/etc/httpd/conf/extra/httpd-phpmyadmin.conf'当中的:

Alias /phpmyadmin/ "/usr/share/webapps/phpMyAdmin/"

修改为:

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"

你可能需要参考 this
thread

.

如果你看到了错误信息 "#2002 - The server is not responding (or the local
MySQL server's socket is not correctly configured)",你可能需要修改
/etc/webapps/phpmyadmin/config.inc.php 文件中的这一行:

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

将"localhost"替换为你的 /etc/hosts 和 /etc/rc.conf文件中指定的主机名。

如果你希望通过访问http://localhost/phpmyadmin/setup
使用phpmyadmin的安装脚本, 需要在/usr/share/webapps/phpmyadmin
目录下创建一个httpd用户可写的配置文件夹:

cd /usr/share/webapps/phpmyadmin
sudo mkdir config
sudo chgrp http config
sudo chmod g+w config

其他信息(过时)

This page holds a sample 'config.inc.php' file that you can place in
the main phpMyAdmin directory so that it immediately starts working

Things you should do first

Create a 'controluser', so that phpmyadmin can read from the main
mysql database.

mysql -u root -pYOURROOTPASSWORD
mysql> grant usage on mysql.* to controluser@localhost identified by 'CONTROLPASS';

Where is phpmyadmin

in phpmyadmin 3.2.2-3 the file is missing /srv/http/ create this
symlik

ln -s /usr/share/webapps/phpMyAdmin/ /srv/http/phpmyadmin

Things you should change

controluser is set to controluser
controlpass is set to password
verbose is set to name_of_server

Sample 'config.inc.php' file

<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 2.11.8.1 setup script by Michal Čihař <michal@cihar.com>
* Version: $Id: setup.php 11423 2008-07-24 17:26:05Z lem9 $
* Date: Mon, 01 Sep 2008 20:34:02 GMT
*/

/* Servers configuration */
$i = 0;

/* Server ravi-test-mysql (http) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['controluser'] = 'controluser';
$cfg['Servers'][$i]['controlpass'] = 'password';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['verbose'] = 'name_of_server';

/* End of servers configuration */

$cfg['LeftFrameLight'] = true;
$cfg['LeftFrameDBTree'] = true;
$cfg['LeftFrameDBSeparator'] = '_';
$cfg['LeftFrameTableSeparator'] = '__';
$cfg['LeftFrameTableLevel'] = 1;
$cfg['LeftDisplayLogo'] = true;
$cfg['LeftDisplayServers'] = false;
$cfg['DisplayServersList'] = false;
$cfg['DisplayDatabasesList'] = 'auto';
$cfg['LeftPointerEnable'] = true;
$cfg['DefaultTabServer'] = 'main.php';
$cfg['DefaultTabDatabase'] = 'db_structure.php';
$cfg['DefaultTabTable'] = 'tbl_structure.php';
$cfg['LightTabs'] = false;
$cfg['ErrorIconic'] = true;
$cfg['MainPageIconic'] = true;
$cfg['ReplaceHelpImg'] = true;
$cfg['NavigationBarIconic'] = 'both';
$cfg['PropertiesIconic'] = 'both';
$cfg['BrowsePointerEnable'] = true;
$cfg['BrowseMarkerEnable'] = true;
$cfg['ModifyDeleteAtRight'] = false;
$cfg['ModifyDeleteAtLeft'] = true;
$cfg['RepeatCells'] = 100;
$cfg['DefaultDisplay'] = 'horizontal';
$cfg['TextareaCols'] = 40;
$cfg['TextareaRows'] = 7;
$cfg['LongtextDoubleTextarea'] = true;
$cfg['TextareaAutoSelect'] = false;
$cfg['CharEditing'] = 'input';
$cfg['CharTextareaCols'] = 40;
$cfg['CharTextareaRows'] = 2;
$cfg['CtrlArrowsMoving'] = true;
$cfg['DefaultPropDisplay'] = 'horizontal';
$cfg['InsertRows'] = 2;
$cfg['EditInWindow'] = true;
$cfg['QueryWindowHeight'] = 310;
$cfg['QueryWindowWidth'] = 550;
$cfg['QueryWindowDefTab'] = 'sql';
$cfg['ForceSSL'] = false;
$cfg['ShowPhpInfo'] = false;
$cfg['ShowChgPassword'] = false;
$cfg['AllowArbitraryServer'] = false;
$cfg['LoginCookieRecall'] = 'something';
$cfg['LoginCookieValidity'] = 1800;
?>

source

抱歉!评论已关闭.