DROP DATABASE IF EXISTS flaskweb; CREATE DATABASE flaskweb; USE flaskweb; GRANT ALL PRIVILEGES ON flaskweb.* TO 'flaskweb'@'localhost' IDENTIFIED BY 'flaskweb'; CREATE TABLE `roles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(64) DEFAULT NULL, `role_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ix_users_username` (`username`), KEY `role_id` (`role_id`), CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8