How to Import/Export database on CloudPanel

Importing and exporting a database in CloudPanel follows a series of steps.In this guide, we will look at how to import and/or export databases in CloudPanel.

Importing a database

We need to upload the database.sql(.zip) file to your VPS. We can upload through the dashboard. First access your website dashboard. Then click File Manager tab, navigate to the folder where you want to upload your database file.

Log in to your VPS via ssh terminal or PuTTY as root, then navigate to the folder where you uploaded your database file and run the following command:

clpctl db:import --databaseName=my-database --file=dump.sql.gz

Replace my-database and dump.sql.gz with the database name and database file respectively. If successful, the output will indicate the import was successful.

Exporting a database

Access your VPS and navigate to the folder where you want to export your database. Then run the following command to export your database:

clpctl db:export --databaseName=my-database --file=dump.sql.gz

The database dump will be gzipped if you add .sql.gz at the end of the file name. If you want to export the database uncompressed, use .sql.

Was this article helpful?

Related Articles

Leave A Comment?