如何利用mysql workbench建数据库建表
刚开始学习PHP连接后台传输前端数据这一块,需要建立一个MySQL数据库和表格,综合我学到的过程和知识写下这篇学习记录。
建立一个数据库
打开workbench点击+号
connection Name内输入数据库连接对象名
点击store Vauit 按钮,接着它会弹出一个窗口让你输入root账号的密码。
输入密码点击OK
点击完成的数据库连接
点击图标添加新的数据库
Name内输入创建的数据库名字,点击Apply,之后弹出的弹窗点击Apply和finsh即可。到这里数据库就已经建立好了。(〃 ̄︶ ̄)人( ̄︶ ̄〃)
建立一个表
双击我们建立好的数据库
字体变黑在进行创建表格,不然会出错(我搜到的教程博主是这么告诉我的),接下来就是点击Tables ,然后就是Create table
填写表格名称等等信息,点击Apply,finsh就搞定了。
要添加数据什么的点击表格user最右边的那个小图标。
附:
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”)
参考博客链接: https://blog.csdn.net/cout__waht/article/details/78010218.