Next:
Query 紀錄詢問
Up:
Tables 資料表
Previous:
PHP 刪除資料表
Contents
DYWANG_HOME
實機操作練習題
以下列步驟完成 mariadb 資料庫及資料表建立、刪除。
遠端登入 kvm3 虛擬機。
以 root 身份登入 mariadb。
在資料庫 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 的欄位描述,並分別導向到 /tmp/createtbl.txt /tmp/createtbl.php.txt。
[root@kvm3 ~]# mysql -uroot -p -e "use dbx; desc tblx"
建立 droptbl.php 刪除資料庫 dbxphp 中的資料表 tblxphp。
De-Yu Wang 2020-09-18