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/"
當然主要是設置訪問權限和別名