Next:
Query 紀錄詢問
Up:
Tables 資料表
Previous:
PHP 刪除資料表
Contents
DYWANG_HOME
實機操作練習題
前置處理
遠端登入 kvm3 虛擬機。
以 root 身份登入 mariadb。
.txt 檔案存檔都存到
/tmp/$mysid.$evalname
目錄,目錄若不存在,必須自行建立,其中變數
$mysid
為自己的學號,
$evalname
為評分程式名稱不加附檔名。
在資料庫 dbx 中建立資料表 tblx,包含下列欄位:
id int not null auto_increment,
title varchar(100) not null,
author varchar(40) not null,
score tinyint,
submission_date date,
primary key (id)
建立 createtbl.php 產生資料庫 dbxphp 中的資料表 tblxphp,資料表內容與 tblx 相同。
使用以下命令查詢資料表 tblx 及 tblxphp 的欄位描述,並分別導向到 createtbl.txt createtbl.php.txt。
[root@kvm3 ~]# mariadb -uroot -p -e "use dbx; desc tblx"
建立 droptbl.php 刪除資料庫 dbxphp 中的資料表 tblxphp。