Sometime we need to do export or copy the large database to somewhere may be other machine or local computer, we have to forcefully download the Database from remote DB.
A large database export can be a tricky to download, currupt data can be there, So there is some good command line script are available by using those, we can easily export the MySQL database from any remote Database like RDS etc.

Here are few of them examples.

1. Export Database

mysqldump --host=YOUR_HOST --port=3306 --default-character-set=utf8 --user=YOUR_USERNAME --protocol=tcp --column-statistics=FALSE --skip-triggers "DB_NAME"

Enter Password

2. Export Database in Zipped Format if your database is too large.

mysqldump -h YOUR_HOST --set-gtid-purged=OFF -u YOUR_USERNAME -p DB_NAME | gzip > DB_NAME.sql.gz

3. Import Database from Zipped Database (Ubuntu)

gunzip < DB_NAME.sql.gz | mysql -h YOUR_HOST -u YOUR_USERNAME -p DB_NAME
Last modified: April 13, 2022