Question

How to add a uploaded SQL gzipped file to MySQL on a managed database?

Posted April 2, 2020 690 views
MySQLDatabases

Hi, I uploaded a large (+1.5GB) gzipped SQL file to my dropplet and would like to add it to my MySQL DB hosted on a managed database. Since there is no SSH on managed DB how should I uncompress and install my SQL file?

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @cmurph, is this a backup/data import that you would like to ingest into the instance?

Hi @cmurph,

You can add droplet ID to MySQL managed database trusted source so that you will be able to access the managed database from the droplet where you have placed (+1.5GB) gzipped SQL file (backup file); Then you can run the below command to import data (make changes to command with your database cluster hostname, password, database name, and SQL file name).

gunzip < backupfile.sql.gz| mysql -u doadmin -p'password' -h db-mysql-xxxx-xxxxx-do-user-xxxxxxx-0.b.db.ondigitalocean.com -P 25060 -D databasename

For more information on importing data to MySQL managed database check the below link :
https://docs.digitalocean.com/products/databases/mysql/how-to/import-databases/

I hope this helps!

Regards,
Rajkishore