1)获取mysql驱动
go get github.com/go-sql-driver/mysql
在$GOPATH/src目录下,有一个github.com/go-sql-driver/mysql目录
2)数据库安装mysql
create table userinfo (
uid int(10) not null auto_increment,
username varchar(64) null default null,
departname varchar(64) null default null,
created date null default null,
primary key(uid));
create table userdetail (
uid int(10) not null default 0,
intro text null,
profile text null,
primary key(uid));
3) 代码
网友评论