2013年8月22日 星期四

phpMyAdmin 的設定

將下載回來的 phpMyAdmin 壓縮檔解開,並搬移到 /var/www 目錄後,將 config.sample.inc.php 複製成 config.inc.php。

接著,編輯 config.inc.php,找到這一行:

$cfg['Servers'][$i]['auth_type'] = 'cookie';

將它修改如下:

$cfg['Servers'][$i]['auth_type'] = 'http';

這是最基本的設定。

不過,當登入 phpMyAdmin 後,卻會發現在畫面下方出現如圖示的訊息:

雖然,這並不影響 phpMyAdmin 的操作,但每次看到這個訊息畫面,也總是覺得不開心。

要修正這點並不是很難,在剛才畫面的最末端就有提示了。

首先,建立一個資料庫,同時建立一個能完整存取這個資料庫的使用者。這裡,我將資料庫和使用者都命名為 phpmyadmin。

接著,在 phpMyAdmin 的目錄裡,找到 examples/create_tables.sql 這個檔案,將它匯入剛才建立的資料庫。

這個步驟一樣可以在 phpMyAdmin 管理介面裡完成。不過,由於我的 MariaDB 安裝在 Debian GNU/Linux 端,而我此時在 Windows 7 遠端操作 phpMyAdmin,所以我改成在 SSH 連線裡,以指令的方式操作:

$ cd phpmyadmin/examples/
$ mysql -uphpmyadmin -p你的密碼 phpmyadmin < create_tables.sql

接著,再修改 phpMyAdmin 的 config.inc.php,去掉以下區塊的註解:

/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
$cfg['Servers'][$i]['controluser'] = 'phpmyadmin';
$cfg['Servers'][$i]['controlpass'] = '你的密碼';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

接著,重新啟動 Apache,並重新登入 phpMyAdmin 管理介面,就不會再看到剛才的錯誤訊息了。

沒有留言: