Information for: DEVELOPERS   PARTNERS

Using MySQL views

In MySQL, views are saved queries that act as a virtual table, producing a set of results when called.


Views in MySQL should not be confused with the Drupal module Views, which became part of Drupal core in Drupal 8.

Acquia Cloud supports the creation of MySQL views in databases, but databases containing views must be copied or restored using the Acquia Cloud interface or the Acquia Cloud API. Both the Acquia Cloud interface and Acquia Cloud API remove server-specific DEFINER clauses from MySQL views that remain in place if you export the database using mysqldump.

To create a mysqldump command that removes server-specific DEFINER clauses, you must pass the output of mysqldump output through a stream editor, replacing the values of [SOURCE_DATABASE] and [TARGET_DATABASE] that are invalid on Acquia Cloud, as displayed in the following example:

mysqldump [SOURCE_DATABASE] | LANG=C sed -e 's|^/[*]!50001 CREATE ALGORITHM=UNDEFINED [*]/|/*!50001 CREATE */|' -e '/^[/][*]!50013 DEFINER=/d' | mysql [TARGET_DATABASE]

All databases in a single Acquia Cloud environment share the same username and password, but each environment in a subscription has its own username and password.

For more information about backing up databases in Acquia Cloud, see Backing up your application.

For additional troubleshooting information about MySQL views, see MySQL views in Acquia Cloud.