Managing your databases

Your Drupal website's database contains its content, configuration, and log information. When you import or create your website in Acquia Cloud, you have multiple environments to manage your website, with each environment having its own database. Because of this, your website can have multiple databases associated with it, depending on which environment you're working in.

You can use the Cloud > Workflow page to drag databases between your website's environments. For more information, including information about protecting the databases and files of your Prod environment by switching to Production mode, see Managing your workflow. You can use the Cloud > Databases page to add, back up, and delete databases, as well as view, restore, and delete database backups.

Adding a new database

  1. On the Cloud > Databases page, click Add database.

    Add a database

  2. Enter the database name, and click Add database. This creates unique databases for each environment and adds a block for the database to the Databases page.
    • If the database is for a new website using Drupal multisite, enter the website name. Then, add the include statement from the Databases page to the settings.php file in the multisite directory (for example, docroot/sites/[sitename]/settings.php).
    • If the database is for additional content for an existing website, enter a name (for example, for a postal code database, use "postalcodes"), and use db_set_active('[Database]') within Drupal to access it. Do not add the include statement from the Databases page to the settings.php file unless you intend the new database to be your website's default Drupal database.

Running a large number of databases on the same site can adversely affect the performance of the database servers or the usability of the Acquia Cloud user interface. For more information, see How many databases can my Acquia Cloud site have?

Configuring your website to use environment databases

On the Cloud > Databases page, click Configure settings.php to display the include statement (sometimes called the require statement) for your database. Add that statement to the end of the settings.php file in your /sites directory.

Database include statement

The database include statement causes your site to use a unique database for each site environment. This allows you to use the same settings.php file in each of your Acquia Cloud environments.

When you use the Cloud > Workflow page to install a Drupal distribution or import a site archive, or import a site using the Acquia Connector, Acquia Cloud creates the database include statement in your settings.php file. Otherwise, you need to edit the settings.php file yourself to add the include statement. Do not add the include statement unless you intend the new database to be your website's default Drupal database.

Moving a database across environments

  1. Open the Workflow page at Cloud > Workflow.
  2. Drag the source database container to the target environment you want to contain the database copy.
  3. Click Copy. The database migration begins.

    Important: Once your website is live, it is generally not a good practice to copy a database into the Prod environment. To reduce the chance that you may do so inadvertently, if the target environment is the Prod environment, you must enter the word CONFIRM before you can click Copy. While the database is being copied, requests that cannot be served from cache will fail.

    Copy database to Prod environment

    You cannot copy a database to your Prod environment when your website is in Production mode. For more information, see Managing your workflow: Production mode and Pre-launch mode in the Prod environment.

The Task log section of the Workflow page displays the database migration progress.

Viewing database credentials

On the Cloud > Databases page, click Database credentials.

View database credentials

The server URL, database name, user name, and password for the database in that environment are listed.

Backing up your database

The Cloud > Databases page displays the date and time of the last created backup for each database in each environment. You can also create on-demand backups and view, download, restore, and delete backups. For more information, see Backing up your site.

Deleting a database

To delete a database:

  1. On the Cloud > Databases page, find the database you want to delete and click Delete, next to Configure settings.php button.

    Delete a database

  2. In the confirmation dialog, click Delete.

    The database is deleted from each of your website's environments.

Note: You cannot delete the primary database for your website. Doing so would prevent your website from working.

Monitoring and accessing your databases

Acquia Cloud provides lots of tools you can use to monitor and access your website's databases:

Related topics