Restoring a backup of a database or table
suggest changemysql [options] db_name < filename.sql
Note that:
db_name
needs to be an existing database;- your authenticated user has sufficient privileges to execute all the commands inside your
filename.sql
; - The file extension
.sql
is fully a matter of style. Any extension would work. - You cannot specify a table name to load into even though you could specify one to dump from. This must be done within
filename.sql
.
Alternatively, when in the MySQL Command line tool, you can restore (or run any other script) by using the source command:
source filename.sql
or
\. filename.sql
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents