Skip to content

Import SQL files into a MySQL server

You can import SQL dumps into your MySQL server directly from the command line. I will assume here that you have the MySQL server installed locally and you have access to MySQL’s root account (and therefore have all rights on the database server).

To import a dump for a single database, run this command after your created the database:

mysql -u root -p <database> < file.sql

To import a dump of multiple databases, simply don’t specify the database parameter:

mysql -u root -p < file.sql



Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.