MySQL 8.0 Database Administrator — Question 21
Binary log events for the ‘mydb1’ schema must be copied to a different schema name ‘mydb2’.
Which command will do this?
Answer options
- A. mysqlbinlog --rewrite-db=’mydb1->mydb2’ | mysql
- B. mysqlbinlog --datebase=mydb1 --database=mydb2 | mysql
- C. mysqlbinlog --rewrite-db=’mydb1’ --rewrite-db=’mydb2’ | mysql
- D. mysqlbinlog --read-from-remote-server --raw | sed ‘s/mydb1/mydb2/g’ | mysql
Correct answer: A
Explanation
The correct answer is A because it uses the --rewrite-db option properly to specify that events from 'mydb1' should be rewritten for 'mydb2'. Option B contains a typo in 'datebase' and also does not rewrite the schema correctly. Option C incorrectly uses two --rewrite-db options without proper syntax, and option D attempts a workaround with sed that is less efficient and may not handle all cases correctly.