Cloud Platform

Using MySQL views

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

Note

Views in MySQL should not be confused with the Views module in Drupal. This module is now part of Drupal core. However, it was not a part of Drupal core 7.

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

To create a mysqldump command that removes infrastructure-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 Cloud Platform, 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 Cloud Platform 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 Cloud Platform, see Taking backups.

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