Importing Data to Cloud Databases
This article describes how to import the data of an existing MySQL database into a Cloud Database. If you haven't already created a Cloud Database instance and an empty database to receive the imported data, you'll need to do that first.
The import process includes the following steps:
- Use the New Cloud Control Panel to create a Cloud Database instance with an empty database and a username and password to access it.
- When the database instance is created, click on it and take note of the Hostname. You'll use it in a later step. The Hostname looks something like this:
- On the machine where your existing database is currently located, run the following MySQL command to export your database:
mysqldump -u username -p database_name > database_name.sql
database_name is the name of your existing datatabase. database_name.sql will be the name of the exported database file. Replace "username" with the username you use to access the original database.
- Using SFTP, copy the exported .sql file to the Cloud Server that will access your Cloud Database.
- With the .sql file copied to your Cloud Server, use ssh to log into the server.
- If you don't have a mysql client installed on your server, install it now.
On Ubuntu and Debian, install the client with the following command:
sudo apt-get install mysql-client
On Fedora and CentOS, install the client with this command:
sudo yum install mysql
- Run the following MySQL import command, substituting that long hostname you copied from the control panel for the address in the command, your database username for "username", and your database name for "database_name":
mysql -h 31blah2d.rackspaceclouddb.com -u username -p database_name < database_name.sql
The database is imported and ready to accept new data.
© 2014 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