建立資料庫,同時指定編碼方式:
create database t01 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
建立資料表的完整範例:
create table admin (
prikey integer unsigned auto_increment primary key,
datechg timestamp on update current_timestamp comment '最後修改的日期時間',
dateadd datetime comment '新增的日期時間',
datedel datetime comment '刪除的日期時間',
...
) DEFAULT CHARACTER SET utf8 ENGINE=InnoDB
prikey integer unsigned auto_increment primary key,
datechg timestamp on update current_timestamp comment '最後修改的日期時間',
dateadd datetime comment '新增的日期時間',
datedel datetime comment '刪除的日期時間',
...
) DEFAULT CHARACTER SET utf8 ENGINE=InnoDB
授權資料庫給某個使用者:
grant all privileges on t01.* to user01@localhost identified by 'password';
附件列表