You've created a mysqldump file stored it in an S3 bucket. Now you've launched a MySQL database server and want to manually retrieve your *.sql database that's saved as a *.gz (gzip) file and load it into the running server.
If possible, you should use a published RightScript or Chef recipe to perform this action. However, you may need to manually perform this operation for development and test purposes.
It is assumed that you have already uploaded your dump file to an S3 bucket.
SSH into your running server and run the following commands, substituting the variables with your own values:
wget http://<S3-BUCKET>.s3.amazonaws.com/<DUMPFILE> gunzip <DUMPFILE> mysqladmin -u root create <DBSCHEMA> mysql <DBSCHEMA> < <DUMPFILE>
To verify that the mysqldump file was properly fetched from the S3 bucket, you can run the following commands:
Note: The name of the database (DBSCHEMA) is "myschema" in the example below.
# mysql mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | myschema | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> use myschema; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +--------------------+ | Tables_in_myschema | +--------------------+ | phptest | +--------------------+ 1 row in set (0.00 sec) mysql> select * from phptest; +----+-----------+-------------+ | id | firstname | lastname | +----+-----------+-------------+ | 1 | John | Doe | | 2 | Greg | Smith | | 3 | Elon | Johnson | | 4 | Dean | Stevenson | +----+-----------+-------------+ 4 rows in set (0.00 sec) mysql> exit
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.