Tutorial: Importing a database


The goal of this tutorial is to migrate an old “non-Elastycloud” database into our platform.


This tutorial will wipe your deployments database and replace it with your own database. It is highly recommended that you try this out on a staging deployment first. This is not an officially supported feature yet, you may encounter issues during this guide that is specific to your case, leaving your deployment in a failed state.


  1. You have to be a registered partner of Elastycloud
  2. You need to have an account and be able to sign in to Console
  3. You need an existing deployment with your own package matching your current stores code.
  4. You need to have a local installation of the above package running so you can prepare a database dump
  5. You need to have a toolkit running


For the site to work after the import, it is important that you take a database-dump from an environment that is running the same codebase that is CURRENTLY deployed.

When exporting a Magento2 database dump you have to remove all definers from your *.sql dump. These definers have a reference to your old mysql credentials.

An example of a definer exported from another system might look like this buried in the mysql-dump.


This MYSQL user will not exist in our system so your import will fail with a permission error. To create a clean mysqldump you can can run the following command:

mysqldump ... | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > new-clean-dump.sql

Or if you already have an existing dump:

sed -i 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' dump-you-made-before.sql


Leaving definers in your database dump WILL result in a permission error during import



Make note of your elastycloud domain name.


Increase the toolkit lifetime inside your toolkit panel at the top right


PhpMyAdmin frontend may timeout with a 504 during long imports but it keeps on working in the background

Inside Console go to Installations ‣ Site deployments and click edit on your deployment.

Scroll all the way down and make note of your domain here.


Save your elastycloud core_config_data for reference

  1. Go to your toolkit, and click Database
  2. Using the phpmyadmin interface go to the core_config_data table
  3. Click export, Export with the default settings and save it locally for reference
  4. Confirm that your core_config_data dump contains SQL
  5. Do the same for the tables elastycloud_domainmanager_domain & elastycloud_domainmanager_domain_assignment

Import the database


Following below steps will delete data in your database and render your deployment broken, until you complete the import.


Please remember to disable foreign key checks when importing a database. Forgetting this may lead to looping and unwanted behaviour.

  1. Go to your toolkit, and click Database

  2. Click Your database name to the left and scroll all the way down, click check all and DROP them. This may take a little while.

  3. Click the IMPORT tab, click CHOOSE FILE and select your complete GZIPPED magento2 database dump from your other provider and click import.

    Make sure your cleaned it of DEFINERS as detailed above.

    This may take a while.

Restore Base URL

  1. Click on the table core_config_data and then on the SEARCH tab.
  2. In the value textbox type in “http%” and hit search
  3. Update all “base_url” entries so they match the domain name you took note of in the preparations above. Take care to include https:// and a slash at the end
  4. Make sure the path “admin/url/custom” is set the same as before, and “admin/url/use_custom” is set to 1
  5. Import the data for tables elastycloud_domainmanager_domain & elastycloud_domainmanager_domain_assignment & elastycloud_ftp_accounts you exported earlier

Restore Asset management settings


These settings must be the same as specified in your elastycloud.yaml file in the root of your repository. If you have not made any changes in asset management in that file it safe to use the defaults below.

  1. Delete all asset management settings from core_config_data, run this query:
DELETE FROM `core_config_data`
WHERE `path` IN (
  1. Add the correct values, run this query:
INSERT INTO `core_config_data`