数据库小练习
数据库练习11、创建数据库school,字符集为utf82、在school数据库中创建Student和Score表3、授权用户tom,密码mysql,能够从任何地方登录并管理数据库school1、创建数据库school,字符集为utf8mysql> create database school default character set utf8mb4;Query OK, 1 row aff
数据库练习1
1、创建数据库school,字符集为utf8
2、在school数据库中创建Student和Score表
3、授权用户tom,密码mysql,能够从任何地方登录并管理数据库school
1、创建数据库school,字符集为utf8
mysql> create database school default character set utf8mb4;
Query OK, 1 row affected (0.00 sec)
mysql> use school;
Database changed
2、在school数据库中创建Student和Score表
mysql> create table Student ( Id int(10) primary key auto_increment comment '学号', Name varchar(20) not null comment '姓名', Sex varchar(4) comment '性别', Birth YEAR comment '出生年份', Department varchar(20) not null comment '院系' , Address varchar(50) comment '家庭住址');
Query OK, 0 rows affected (0.03 sec)
mysql> create table Score( -> Id INT(10) primary key auto_increment comment '编号', -> Stu_id INT(10) not null comment '编号', -> C_name VARCHAR(20) comment '课程名', -> Grade INT(10) comment '分数' ) -> ;
3、授权用户tom,密码mysql,能够从任何地方登录并管理数据库school
mysql> create user tom@'192.168.157.%' identified by 'Tom@1234';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on school.* to tom@'192.168.157.%';
Query OK, 0 rows affected (0.01 sec)使用客户端登录
更多推荐
所有评论(0)