vue.js+koa2项目实战(六)数据库建表

数据库建表

1.打开 MySQL 终端

2.查看所有数据库

show databases

3.创建数据库

create database pet

4.进入数据库

use pet

5.创建数据表

create table users(
id bigint not null auto_increment primary key,
email varchar(60) not null,
pwd varchar(60) not null,
nicheng varchar(60) not null,
updtime timestamp not null,/*时间戳形式*/
role tinyint not null default 0,/*0表普通用户,1表商家,2表管理员*/
createtime timestamp not null,
msgnum int(4) default 0,
unique key emailuniq (email),
unique key nichenguniq (nicheng)
)ENGINE=innodb DEFAULT CHARSET=utf8;

6.查看数据表

show tables

.

原文地址:https://www.cnblogs.com/crazycode2/p/7668857.html