{"_id":"5bb503fc70d0980003218a8f","project":"54cf411f9d09bb0d00a17a1c","version":{"_id":"54cf411f9d09bb0d00a17a1f","project":"54cf411f9d09bb0d00a17a1c","__v":15,"createdAt":"2015-02-02T09:19:27.656Z","releaseDate":"2015-02-02T09:19:27.656Z","categories":["54cf41209d09bb0d00a17a20","54cfb99bbba1a023008741af","54cfb9a65ff7e617002bbd7f","54cfba03bba1a023008741b6","54cfba0ebba1a023008741b8","54cfba19bba1a023008741b9","54cfba29bba1a023008741bb","54cfba345ff7e617002bbd87","54cfba3ebba1a023008741bc","54cfba473995cf0d0006f6f0","54e371b18ef7552300409bf2","54e37aa5e887c50d005ef629","555a4e9b147f91190092d137","56b0e91802f4bc0d006ce254","5bb4f4e01635b500032b94fd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5bb4f4e01635b500032b94fd","project":"54cf411f9d09bb0d00a17a1c","version":"54cf411f9d09bb0d00a17a1f","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-10-03T16:57:04.619Z","from_sync":false,"order":7,"slug":"migrating","title":"Migrating to AWS Cloud9"},"user":"5bac0709475b5d000364fa42","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-10-03T18:01:32.036Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"In this phase, you save data from a database, depending on the type of template that you originally created your workspace with. You then download that saved data to your computer or GitHub.\n\nThis topic describes how to save data from the following databases:\n\n* MySQL\n* PostgreSQL\n* MongoDB\n\n# To save data from MySQL\n\nUse [mysqldump](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html). \n\nFor example, the following command saves all databases in the local MySQL installation (except for the **event** table in the **mysql** database) as a .sql file inside of a compressed GZ file in the current directory. The .sql file is named **mysqldump_my-workspace-name_YYYY-MM-DD.sql**, and the compressed GZ file is named **mysqldump_my-workspace-name_YYYY-MM-DD.sql.gz**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"mysqldump --ignore-table=mysql.event --all-databases | gzip > \\\"mysqldump_my-workspace-name_YYYY-MM-DD.sql.gz\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n(See some more [mysqldump examples](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#mysqldump-option-examples).)\n\nTo download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer).\n\nTo upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository).\n\nWhen you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace).\n\n# To save data from PostgreSQL\n\nUse [pg_dump](https://www.postgresql.org/docs/current/static/app-pgdump.html). \n\nFor example, the following command saves the database named **my_database_name** to a file named **my_database_name_dump.sql** in the current directory:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pg_dump my_database_name > my_database_name_dump.sql\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n(To see more examples, scroll to the \"Examples\" section at the end of the [pg_dump](https://www.postgresql.org/docs/current/static/app-pgdump.html) page.)\n\nTo download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer).\n\nTo upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository).\n\nWhen you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace).\n\n# To save data from MongoDB\n\nUse [mongodump](https://docs.mongodb.com/manual/reference/program/mongodump). \n\nFor example, the following command saves the database named **my_database_name** to a file named **my_database_name_dump.archive** in the current directory:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"mongodump --db my_database_name --archive=my_database_name_dump.archive \",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n(See some more [mongodump examples](https://docs.mongodb.com/manual/reference/program/mongodump/#examples).)\n\nTo download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer).\n\nTo upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository).\n\nWhen you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace).","excerpt":"","slug":"downloading-data-from-a-database","type":"basic","title":"Downloading Data from a Database"}

Downloading Data from a Database


In this phase, you save data from a database, depending on the type of template that you originally created your workspace with. You then download that saved data to your computer or GitHub. This topic describes how to save data from the following databases: * MySQL * PostgreSQL * MongoDB # To save data from MySQL Use [mysqldump](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html). For example, the following command saves all databases in the local MySQL installation (except for the **event** table in the **mysql** database) as a .sql file inside of a compressed GZ file in the current directory. The .sql file is named **mysqldump_my-workspace-name_YYYY-MM-DD.sql**, and the compressed GZ file is named **mysqldump_my-workspace-name_YYYY-MM-DD.sql.gz**: [block:code] { "codes": [ { "code": "mysqldump --ignore-table=mysql.event --all-databases | gzip > \"mysqldump_my-workspace-name_YYYY-MM-DD.sql.gz\"", "language": "shell" } ] } [/block] (See some more [mysqldump examples](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#mysqldump-option-examples).) To download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer). To upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository). When you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace). # To save data from PostgreSQL Use [pg_dump](https://www.postgresql.org/docs/current/static/app-pgdump.html). For example, the following command saves the database named **my_database_name** to a file named **my_database_name_dump.sql** in the current directory: [block:code] { "codes": [ { "code": "pg_dump my_database_name > my_database_name_dump.sql", "language": "shell" } ] } [/block] (To see more examples, scroll to the "Examples" section at the end of the [pg_dump](https://www.postgresql.org/docs/current/static/app-pgdump.html) page.) To download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer). To upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository). When you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace). # To save data from MongoDB Use [mongodump](https://docs.mongodb.com/manual/reference/program/mongodump). For example, the following command saves the database named **my_database_name** to a file named **my_database_name_dump.archive** in the current directory: [block:code] { "codes": [ { "code": "mongodump --db my_database_name --archive=my_database_name_dump.archive ", "language": "shell" } ] } [/block] (See some more [mongodump examples](https://docs.mongodb.com/manual/reference/program/mongodump/#examples).) To download saved data to your computer, see [Downloading Files to Your Computer](doc:downloading-files-to-your-computer). To upload saved data to a source code repository, see [Uploading Files to a Source Code Repository](doc:uploading-files-to-a-source-code-repository). When you're done, [return to the migration checklist](migration-checklist#section-step-1-download-folders-files-and-data-from-your-workspace).