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.
© 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

2 Comments
mysqldump needs the -h parameter to work as described
mysqldump -h serverkhjhkjwhatever.rackspaceclouddb.com -u root -p database_name > database_name.sql
re: -h
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