Working with databases

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

You can use the Environments page in the Acquia Cloud interface to copy a database from one of your application's environments to another, just by dragging the database between environments. You can use the Application > Environments page to add, back up, and delete databases, as well as view, restore, and delete database backups.

Adding a new database

Drupal sets up the application's primary database when you install Drupal. Your application might also require additional databases. You can create additional databases by using the Acquia Cloud interface.

  1. On the Applications > Environments page, click Add Database in the upper right.

    Add a database

  2. Enter the database name, and then 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 application, 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 application's default Drupal database.

Using many databases

Running a large number of databases in the same application can adversely affect the performance of the database servers or the usability of the Acquia Cloud interface. Acquia Cloud limits you from running more than 100 databases per subscription. If you believe you need a larger number of distinct databases, you should split your sites to run on multiple clusters. If you have any questions about your current database usage or the limits on your account, contact Acquia Support.

Configuring your application to use environment databases

On the Applications > Databases page, click PHP to display the include statement (sometimes called the require statement) for your database. The include statement should be at the end of the settings.php file in your /sites directory, but should precede any other Acquia Cloud-specific entries in settings.php, including Memcached configuration code or any code that uses Acquia Cloud environment variables.

Database include statement

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

When you use the Acquia Cloud interface to install a Drupal distribution or import a site archive, or import an application 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 application's default Drupal database.

Copying a database across environments

As you develop your application, you may often want to update an environment with the version of the database from a different environment. Most commonly, you may want to update your Dev or Stage environment databases with the content and configuration from your Prod environment.

  1. Open the Applications > Environments page for your application.
  2. In the grid view, drag the source database container to the target environment that you want to contain the database copy. For example, drag the Prod database to the Dev environment.
  3. If the application has more than one database, select the database you want to copy, or click All to select all of the databases. Then, click Continue.
  4. Click Copy to confirm that you want to overwrite the target environment's database with the source environment's database. The database migration begins.

Viewing database information

On the Databases page, click Details.

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

Backing up your database

The 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 application.

Deleting a database

You can use the Databases page to delete a database, so long as it is not your Drupal application's primary database. You cannot delete the primary database for your application. Doing so would prevent your application from working. To delete a database, complete the following steps:

  1. On the Databases page, find the database you want to delete and click Delete.
  2. In the confirmation dialog, enter your Acquia Cloud password and then click Delete.

Monitoring and accessing your databases

Acquia Cloud provides several tools that you can use to monitor and access your application's databases:

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
By submitting this form, you accept the Mollom privacy policy.

Contact supportStill need assistance? Contact Acquia Support