出自:国家开放大学数据库运维
系统管理员维护了一个远程服务器的数据库ED,数据库中有多张表,表的创建语句为:
create table employees(
emp_no int(11) primary key,
birth_date date,
first_name varchar(14),
last_name varchar(16),
gender enum(‘M’,’F’),
hire_date date);
create table departments(
dept_no char(4) primary key,
dept_name varchar(40));
其中连接数据库的用户名为root,密码为123456。
(1)2019年5月15日对数据库ED进行备份,其命令为
简答题 (1 分)
答:mysqldump -uroot -p123456 ed<ed.sql
(2)2019年5月16日上午10:00误操作删除数据库ed中的数据表employees,语句为
简答题 (1 分)
答:drop table employees;
(3)之后,又向数据库departments中插入两条数据。
简答题 (1 分)
答:insert into table department values (.0001.,.数据部门.);
insert into table department values (.0002.,.人力资源.);
(4)此时数据库中只有一个二进制日志文件mysql-bin.000001,此时利用(2)的备份文件以及二进制文件还原表和数据,需要执行的操作是
简答题 (1 分)
答:source ed.sql
mysqlbinlog --stop -datetime="2019-05-16 9:59:59" mysql-bin.00001>file.sql
source file.sql
mysqlbinlog --start -datetime="2018-10-16 10:00:00" mysql-bin.00001>fil2e.sql
source file2.sql