How to export (mysqldump) and import a mysql database via command line Print

  • 1

How to export (mysqldump) and import a mysql database via command line

Last Updated: 1/24/2015

This article applies to the following services:
  • VPS (Linux only)
  • Dedicated servers (Linux only)

To export a database via the command line, use the following:

mysqldump -p -u USERNAME DATABASE_NAME > DBNAME.sql

You'll be prompted to enter the password.

To import the database back into MySQL, use the following:

mysql -p u USERNAME DATABASE_NAME < DBNAME.sql

You'll be promted to enter the password.

Was this answer helpful?

« Back