CREATE TABLE IF NOT EXISTS `goods` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NOT NULL,
`category` VARCHAR(128) NOT NULL,
`price` INT NOT NULL,
`description` TEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
CREATE TABLE IF NOT EXISTS `members` (
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(128) NOT NULL,
`password` VARCHAR(256) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
)ENGINE=INNODB DEFAULT CHARSET=UTF8;
CREATE TABLE IF NOT EXISTS `purchases` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`userid` INT NOT NULL,
`goodsid` INT NOT NULL,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
)ENGINE=INNODB DEFAULT CHARSET=UTF8;
create user 'micro'@'%' identified by 'service';
grant all privileges on monolithic.* to 'micro'@'%';
flush privileges;
select user, password from mysql.user where user='micro';
댓글