A MySQL Dump is a standardised and universal backup solution for MySQL databases. It is slower than a raw backup (backing up the physical binary files of the database) because it includes a set of SQL statements that can be executed to reproduce the original database object definitions and table data.
You can use a MySQL dump to copy the entire database from your local environment to a Pressidium hosted website or migrate your site data from another hosting provider. This is an advanced operation and can / will overwrite the contents of your website so caution is required.
To import a MySQL dump file to a website:
- Upload the SQL file or compessed SQL file archive to a web location. This can be for example the document root / public html folder of a website, a publicly shared Dropbox or Google Drive folder etc. It is recommended to use a file name that is difficult to guess (a common approach is to include a date part and some random characters).
- Navigate to the website overview screen by selecting / clicking on the related card in the Websites overview screen. Tip: You can quickly navigate to a website by using the S keyboard shortcut to bring up the quick search dialog.
- Verify the environment you want to import to, Production or Staging by checking out the currently selected environment in the navigation bar.
- Click on the Database menu.
- Click Import MySQL dump and provide the full URL to the database dump file. You can import a plain text SQL file or a compressed archive containing the SQL dump file. The later is prefered for larger dumps. The URL must be publicly accessible and not password protected or othewise restricted.
- Click Import to Production or Import to Staging to begin the import process. A background job is initiated to retrieve and import the file. You will receive an email and a Dashboard notification as soon as the process is completed. If for any reason the import process fails (see below for some common cases) a restore operation will be automatically performed to return the website to it's previous state.
Things to consider before beginning the process:
- Ensure that only one sql file (with extension .sql) is present in the uploaded archive if uploading a compressed archive.
- Ensure that the URL is publicly accessible and no access restrictions are present.
- Ensure that the file is accessible during the import process. Moving or renaming the file while the process is running may cause it to fail.
- Ensure that the sql file contains database object definitions and table names for a single WordPress installation. Multiple installations are not supported.
- Ensure that the sql file database object definitions and table names contain the correct WordPress database table prefix. This prefix must match the one that your website is using. During the import process we will perform a database search and replace for domain related database strings for tables that have the correct table prefix.
- Ensure that the import file does not contain errors or statements that could potentially fail. A common case is trying to create database objects that already exist in the target database (e.g. CREATE TABLE without an EXISTS check).
It is recommended to remove the file from the web location as soon as it is not needed to avoid accidental data exposure.