如何制作MYSQL用户表?
drop table IF EXISTS `group_user`;drop table IF EXISTS `users`;
drop table IF EXISTS `groups`;
CREATE TABLE `users` (
`user_id` char(32) NOT NULL,
`user_name` varchar(40) NOT NULL,
`user_password` varchar(40) NOT NULL,
`user_email` varchar(60) NOT NULL,
`register_time` datetime default NULL,
`valid` int(1) NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table `groups` (`group_id` char(32) not null,
`group_name` varchar(40) not null,
`description` varchar(40),
primary key (`group_id`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table `group_user`(`group_id` char(32) not null,
`user_id` char(32) not null,
key(`group_id`),
key(`user_id`),
CONSTRAINT `group_user_fk_1` FOREIGN KEY (`group_id`)
REFERENCES `groups`(`group_id`),
CONSTRAINT `group_user_fk_2` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;
本文地址:http://www.45fan.com/dnjc/68220.html