MySQL数据库实验1答案:
1. 创建数据库:CREATE DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;2. 创建用户并授权:CREATE USER 'testuser'@'%' IDENTIFIED BY '123456';GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES;3. 创建表:CREATE TABLE `student` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(20) DEFAULT NULL,`gender` char(1) DEFAULT NULL,`age` int(11) DEFAULT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;4. 插入数据:INSERT INTO `student` VALUES (1,'Tom','M',20),(2,'Lucy','F',21),(3,'Jack','M',22),(4,'Lily','F',23);5. 查询数据:SELECT * FROM `student`;6. 更新数据:UPDATE `student` SET `age`=25 WHERE `id`=1;7. 删除数据:DELETE FROM `student` WHERE `id`=2;8. 删除表:DROP TABLE `student`;9. 删除数据库:DROP DATABASE `test`;