點擊上圖中的“加號”圖標,新建一個連接,
如上圖,先輸入數據庫的賬號密碼,帳號默認為root,填好密碼后 點擊“OK”,連接就建立好了,建立完成后,會出現一個長方形的框框,雙擊它,出現下圖所示頁面
點擊圖中的紅圈里的按鈕,新建一個Schema,即數據庫(個人理解。。),修改一下Name 的值,如 mydatabase ,點擊apply,再點apply,然后點finish 如下圖所示
數據庫就建好了!!! 如圖
接下來就是如何創建表,
首先要 !!!雙擊!!! 一下剛剛建立好的數據庫mydatabase,然后再創建表,不然會出錯,右鍵點擊Tables 然后點擊Create new tables ,填寫表名,以及表列的信息,之后點擊 apply ,一張表就建完了
PK: primary key (column is part of a pk) 主鍵
NN: not null (column is nullable) 是否為空
-UQ: unique (column is part of a unique key) 外鍵
AI: auto increment (the column is auto incremented when rows are inserted) 自動增加
BIN: binary (if dt is a blob or similar, this indicates that is binary data, rather than text) 二進制
UN: unsigned (for integer types, see docs: “10.2. Numeric Types”)
- ZF: zero fill (rather a display related flag, see docs: “10.2. Numeric Types”)
出現如下頁面
接下來向建好的tb_student表中添加數據
右鍵點擊tb_student,再點擊select rows limit 1000
在mysql workbench中向數據庫中的表中添加數據大致就是這個樣子。
以上有什么說的不對的地方,還請大神多多指教。