Restore a MySQL database from a .sql file

You are able to use the command line to restore a database using the mysql command.  To restore a file named backup.sql to the database data_base, first make sure that the database is empty, then you can run

mysql -o data_base < backup.sql 

It is good to use mysql -o when restoring the database, which makes sure to only affect the database that you specify in the command.

Popular Posts
  • No Popular Post Available
Leave a Reply

Your email address will not be published. Required fields are marked *