23.9k views
2 votes
You need to restore a MySQL database from a backup file. Which command-line tool do you use for the actual data import, after re-creating the database?

a) mysqlimport
b) mysqldump
c) mysqlrestore
d) mysqlreimport

1 Answer

1 vote

Final answer:

To restore a MySQL database, the command-line tool named 'mysql' is used after creating a new database. 'mysqldump' is for creating backups, while 'mysqlimport' loads tables from text files; 'mysqlrestore' and 'mysqlreimport' are not standard MySQL tools.

Step-by-step explanation:

To restore a MySQL database from a backup file, you would use the command-line tool mysql. This tool is specifically designed for interacting with MySQL databases, including restoring them from a backup. After re-creating the database, here's how you would typically proceed:

  • Check the backup file to ensure it's a valid SQL dump file, usually with a .sql extension.
  • Log in to your MySQL server and create a new database to hold the backup data.
  • Use the following command to restore the database from the backup file:
    mysql -u [username] -p [database_name] < [backup_file . sql]

Note that mysqldump is used for creating backups, not restoring them. Also, mysqlimport is a different command-line tool that is used to load tables from text files in various formats, and mysqlrestore and mysqlreimport are not recognized MySQL command-line tools.

User Whats Going On
by
8.1k points