• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Exporting Data


Use the following MySQL command to export your database.

mysqldump -u root -p database_name > database_name.sql

database_name is the name of your existing database. database_name.sql will be the name of the exported database file.

If your database resides on a remote host (as it would if you're using Cloud Databases) you'll need to specify the hostname with the "-h" option, as in:

mysqldump -h host_name -u root -p database_name > database_name.sql

It's also possible to set the "MYSQL_HOST" environment variable to the remote host's address so you don't have to enter it on the command line.

If you want to import this data to another database, see our article on Importing Data.

External Links

MYSQL Documentation



© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

2 Comments

The documentation is incomplete and erroneous: mysqldump needs the -h parameter to work as described. To backup a cloud database, the correct command to issue from a cloud server should be in the format of:
mysqldump -h serverkhjhkjwhatever.rackspaceclouddb.com -u root -p database_name > database_name.sql

Thanks Niel, good point. This article was written for general use with MySQL and assumes a localhost connection, so we should indeed have modified it before pointing Cloud Databases users to it. We'll get that fixed.

Along with the -h option to specify the host, it's also possible to set up an options file or environment variable that will specify the remote host and save you some typing.

Add new comment