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.
- On the Cloud > Databases page, click Add database.
- 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.phpfile in the multisite directory (for example,
- 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.phpfile 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?
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
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.
- Open the Workflow page at Cloud > Workflow.
- Drag the source database container to the target environment you want to contain the database copy.
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.
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.
On the Cloud > Databases page, click Database credentials.
The server URL, database name, user name, and password for the database in that environment are listed.
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.
To delete a database:
- On the Cloud > Databases page, find the database you want to delete and click Delete, next to Configure settings.php button.
- 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.
Acquia Cloud provides lots of tools you can use to monitor and access your website's databases:
- Access the MySQL command line. You have full grants, giving you complete control of the database.
- Administer your database with a desktop application or phpMyAdmin.
- View the slow query logs.
- See detailed MySQL statistics and graphs of the database cache hit rate and prunes on the Insight > My SQL Statistics page.
- Trace database queries using New Relic, an Acquia subscription add-on.