1Z0-888 · Question #33
You created a backup of the world database with this command: shell> mysqldump --opt world > dump.sql Which two will import the data from dump.sql?
The correct answer is C. shell> mysqlimport test dump.sql D. mysql> USE test; mysql> LOAD DATA INFILE 'dump.sql'. The stated correct answers of C and D are actually incorrect - this appears to be an error in the answer key. The true correct answers are B and E. Why B and E are correct: B (mysql test < dump.sql) works because mysqldump produces a plain SQL script, and the mysql client can…
Question
shell> mysqldump --opt world > dump.sql Which two will import the data from dump.sql?Options
- Ashell> mysqladmin recover test dump.sql
- Bshell> mysql test < dump.sql
- Cshell> mysqlimport test dump.sql
- Dmysql> USE test; mysql> LOAD DATA INFILE 'dump.sql';
- Emysql>USE test; mysql>SOURCE dump.sql;
How the community answered
(33 responses)- A12% (4)
- B3% (1)
- C79% (26)
- E6% (2)
Explanation
The stated correct answers of C and D are actually incorrect - this appears to be an error in the answer key. The true correct answers are B and E.
Why B and E are correct:
- B (
mysql test < dump.sql) works becausemysqldumpproduces a plain SQL script, and themysqlclient can execute it via shell redirection - this is the standard restore method. - E (
SOURCE dump.sql) works for the same reason: the MySQL client'sSOURCEcommand reads and executes SQL statements from a file line by line.
Why the others are wrong:
- A -
mysqladminhas norecovercommand; it handles server administration tasks like status checks and shutdown, not data import. - C -
mysqlimportis for importing delimited text files (CSV/TSV), where the filename must match the target table name. It cannot parse a SQL dump script. - D -
LOAD DATA INFILEalso imports delimited text data, not SQL statements. It expects rows of column-separated values, notCREATE TABLE/INSERTsyntax.
Memory tip: mysqldump produces SQL code, so you restore it with tools that run SQL - the mysql client (via < redirect or SOURCE). Tools like mysqlimport and LOAD DATA INFILE are for structured text data, not SQL scripts. Think: dump = SQL script = needs SQL executor.
Topics
Community Discussion
No community discussion yet for this question.