Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am going to importi a database.. (db.sql)

I will use something like:

mysql -u root -p db < db.sql

Can you tell me what the difference is between this and mysqldump?


share|improve this question
up vote 5 down vote accepted

mysqldump is the export tool with which you would create the file to import, e.g.

mysqldump -u root -p db > db-export.sql

The resulting file will consist largely of SQL CREATE statements, followed by INSERT statements.

mysql is the interactive MySQL client, which will also happily take a file full of SQL on stdin and carry out those queries -- in this case, importing the exported dump.

share|improve this answer

mysqldump is for export/backup databases:

mysqldump -u root -p db > db.sql
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.