Skip to main content
Last Reviewed: December 13, 2022

Add Database


Now that you've set up your Pantheon Dev environment, you need to import your database.

Create a .sql Dump File

The Database import requires a single .sql dump that contains the site's content and configurations.

  1. Create a .sql dump using the mysqldump utility.

  2. Compress the resulting archive with gzip to reduce the size for a faster transfer:

    mysqldump -uUSERNAME -pPASSWORD DATABASENAME > ~/db.sql
    gzip ~/db.sql
    • Replace USERNAME with a MySQL user with permissions to access your site's database.
    • Replace PASSWORD with the MySQL user's password. To force a password prompt, move -p to the end of the command and leave it blank. This prevents your MySQL password from being visible on your terminal.
    • Replace DATABASE with the name of your site database within MySQL.
    • ~/db.sql defines the output target to a file named db.sql in your user's home directory. Adjust to match your desired location.

The resulting file will be named db.sql.gz You can use either the Pantheon Dashboard or a MySQL client to add your site's database.

Add Your Database to Pantheon's Platform

  1. Select the Dev environment in the Site Dashboard.

  2. Select Database / Files.

  3. Click Import and add your archive accordingly (based on file size):

    If your archive is under 100MB, upload the file directly:

    1. Navigate to the MySQL database field > click File > Choose File.

    2. Select your local archive file > click Import.

      Import MySQL database from file

      Note: If you recently imported the database and need to re-import, refresh the page and use a new filename for the database file.