phpadmin是用于管理mysql数据库的一个产品,,毕竟很多数据库服务器不能够公开连接,所以只能够使用http的方式来进行连接管理。
下载phpadmin( http://xj-http.skycn.net:8181/down/phpMyAdmin-2.6.1-rc2.zip)解压到apache能够访问的一个目录中(首先apache和php已经集成好了,能够浏览php页面)。运行访问index.php会出现一些提示情况。如果你的mysql安全设置不错的话,可能默认情况下是不能够连接到你的服务器的,需要修改一些配置信息。
修改phpadmin/config.inc.php文件,其中主要是对mysql连接方式,连接路径以及用户名密码的设置。
修改如下:
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpadmin/';
$cfg['PmaAbsoluteUri_DisableWarning'] = TRUE;
$cfg['blowfish_secret'] = 'admin';
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
// (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings
// (this user must have read-only
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
// and "mysql/db" tables).
// The controluser is also
// used for all relational
// features (pmadb)
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = ''; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
其中比较重要的几个参数意义:
$cfg['blowfish_secret'] = 'admin';
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
// (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings
// (this user must have read-only
$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"
// and "mysql/db" tables).
// The controluser is also
// used for all relational
// features (pmadb)
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = ''; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
其中比较重要的几个参数意义:
'PmaAbsoluteUri' phpadmin的全路径,如果在apache中设定了一个alias的话就使用这个了
'PmaAbsoluteUri_DisableWarning' 这个好像是用于取消警告的,经常安装好了在访问的页面上面会出现一些红色字体的警告(安全等等),如果设置成为true就不出现了
'blowfish_secret' 这个是如果授权方式设置成为cookie的话就会使用这个来进行加密存入到cookie中的用户名和密码
'auth_type' 用于设置登陆方式,config是直接从这个文件中获取user/password然后连接数据库,http则是在客户端访问的时候会弹出一个输入用户名密码的框进行认证处理 cookie则是通过页面输入用户名密码进行连接。其中config的安全等级最低,cookie的等级最高,不过如果禁用了cookie则无法使用cookie的方式进行认证。
通常设置成为cookie的方式以后要在apache的httpd.conf文件中修改对应的配置:
#added for phpmyadmin
Alias /phpadmin/ "website/phpMyAdmin-2.6.1-rc2/"
#php_admin_flag engine on
#php_admin_flag safe_mode off
DirectoryIndex index.php
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#php_admin_flag engine on
#php_admin_flag safe_mode off
#php_admin_value open_basedir none
#php_admin_value open_basedir "website/phpMyAdmin-2.6.1-rc2/"
Alias /phpadmin/ "website/phpMyAdmin-2.6.1-rc2/"
#php_admin_flag engine on
#php_admin_flag safe_mode off
DirectoryIndex index.php
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#php_admin_flag engine on
#php_admin_flag safe_mode off
#php_admin_value open_basedir none
#php_admin_value open_basedir "website/phpMyAdmin-2.6.1-rc2/"
当然主要是设置访问权限和别名