Exporting Data from MySQL


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 username -p database_name > database_name.sql

Note: Insert the username you created for username in this command.

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



Was this content helpful?




© 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