登录root账户创建普通账户并给普通账户授权:
(1) 创建一个密码为“123456”的普通用户账户“databasenormal”; (2分)
(2) 创建名为student的数据库;(2分)
(3) 创建名为student2的表,包括stuno(学号列)、stubir(生日列)、age(年龄列),并设置主键为stuno;(8分)
(4) 使用grant命令对其进行student 数据库的student2的表的stuno列的select操作授权; (2分)
(5) 查看mysql数据库下user表中该用户的所有信息;(2分)
(6) 查看mysql数据库下table_priv表中该用户的所有信息;(2分)
(7) 查看mysql数据库下columns_priv表中该用户的所有信息;(2分)

答案
(1)创建一个密码为“123456”的普通用户账户“databasenormal”; (2分)
答案:
create user ‘databasenormal’@’localhost’ identified by ‘123456’;
(2)创建名为student的数据库(2分)
答案:
create database student;
(3)创建名为student2的表,包括stuno(学号列)、stubir(生日列)、age(年龄列),并设置主键为stuno(8分)
答案:
create table student2
( stuno char(50),
stubir char(4),
age int,
PRIMRY KEY stuno
);
(4)使用grant命令对其进行student 数据库的student2的表的stuno列的select操作授权;
答案:(2分)
grant select(stuno) on student.student2 to databasenormal@localhost;
(5)查看mysql数据库下user表中该用户的所有信息;(2分)
答案:
select * from user where User='databasenormal'
(6)查看mysql数据库下table_priv表中该用户条目(2分)
答案:
select * from tables_priv where User='databasenormal' ;
(7)查看mysql数据库下columns_priv表中该用户条目(2分)
答案:
select * from columns_priv where User='databasenormal' ;