於是找到一些網路上的資料,以尋求解決問題,首先這是 偶素汪汪 http://uang43.wordpress.com/2009/05/06/0506-mysql-%E9%96%8B%E5%95%9F%E9%97%9C%E8%81%AF%E5%BC%8F%E8%B3%87%E6%96%99%E5%BA%AB%E8%A8%AD%E5%AE%9A/
所提出的解決方案:
=========================轉貼內容分隔線==========================
MySQL 開啟關聯式資料庫設定
Appserv是學生們常會用的 PHP與MySQL整合伺服軟體,
最近發現原來MySQL的操作界面(phpMyAdmin)上,關聯式資料庫功能是沒辦法用的~ 囧~
一個資料庫沒辦法用關聯性設定,那還算是資料庫嗎? = = 一度想要用微軟的Access~
後來找一找資料,發現了要啟動這個功能的做法,
不過,網路上講的實在是讓一般人都聽不懂吧!
所以在這裡寫下自已的心得:
—————————————————————————-
首先呢,下載 Appserv 2.5.10,安裝的時候記得打勾 「 InnoDB 」,這樣才能有關聯性功能,
我們安裝好Appserv後,進去phpMyAdmin界面,都會發現『應該』已經有存在一個叫 「phpmyadmin」的資料庫,
如果沒有的話,就是我們的版本不太一樣,我是用 Appserv 2.5.10,而且版本不一樣的話,可能不太適用下面要做的事情。
然後呢,其實這個資料庫就是要來存放一些系統的資訊,而且就是包含了我們在設定資料庫關聯性時的一些設定資料,就會存在這裡。
如果沒有這個資料庫沒關係,接下來要做的會新增這個資料庫出來。
進入 C:\AppServ\www\phpMyAdmin\scripts , 會發現有
create_tables.sql
upgrade_tables_mysql_4_1_2+.sql
這兩個檔案在裡面,這兩個就是幫我們設定 phpmyadmin資料庫的檔案,
前設定:
——————————-
我們先打開 create_tables.sql
找到 ‘pma’@localhost ,這個表示 pma 這個使用者,因為我們都用 root ,所以改成 ‘root’@localhost
然後存檔。
———————————
接著進入 phpMyAdmin界面,
左上按下 查詢視窗 ( 有 SQL 的那個圖示 ),會新開一個查詢視窗出來,
在查詢視窗裡面按上面的 「輸入檔案」,
然後選瀏覽,指到 create_tables.sql 這個檔案,
之後便會新增了 phpmyadmin 這個資料庫,
一樣,接著再選 upgrade_tables_mysql_4_1_2+.sql 去執行。
這樣基本的 phpmyadmin 資料庫就建置好了。
—————————————-
接下來我們要去開啟 關聯性資料庫的功能。
到 C:\AppServ\www\phpMyAdmin 把 config.inc.php 打開修改
$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]['designer_coords'] = ‘pma_designer_coords’;
$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]['designer_coords'] = ‘pma_designer_coords’;
找上面的文字,把 = 後面缺少的補上去,
可以發現,等號後面的就是我們剛才建立的一些資料庫和資料表的名字,
這個檔案就是要用來指定系統要把資訊寫到哪裡的設定檔,
改好後存檔,可能要重啟一下 MySQL 服務。
—————————————-
接著,進入phpMyAdmin界面,在使用時就會多出 Designer 的按鍵,就可以設定資料庫關聯性了。
===========================轉貼結束============================
沒有留言:
張貼留言