Troubleshooting

Old Drupal, conflict with the system table in MySQL 8

Reviewed on 2 min read mysql compatibilidad

Withdrawn procedure. Do not rename the system table or add an isolated prefix in production. Drupal 6 and Drupal 7 are no longer supported, and a partial change can break core or module queries.

MySQL 8 made SYSTEM a reserved word. A generic 1064 error does not prove that this is the cause: keep the full query and confirm that it fails precisely when referring to system without escaping.

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds

Drupal 7.76 added support for MySQL 8 and escaping of reserved names. The $db_prefix setting shown in the old procedure belonged to Drupal 6; Drupal 7 uses prefix inside $databases['default']['default']. Neither of those branches should be published again as a permanent site.

Safe recovery

  • Isolate the installation and create verified backups of files and database.
  • If it is Drupal 7 earlier than 7.76, update only an isolated copy to the latest Drupal 7 version to regain read compatibility with MySQL 8.
  • If it is Drupal 6, use a database compatible with that version in the recovery environment; do not expose it to the Internet.
  • Migrate the data to a maintained version of Drupal and check users, content, files, URLs and modules before publishing.

See the official announcement of MySQL 8 support in Drupal 7.76. If a module's direct query still does not escape the table, replace or fix that module in the clone; do not rename a core table to hide the symptom.

After regaining read access

Check counts, users, files and content before exporting to the destination. A query working again does not prove that every module is compatible with MySQL 8, or that the old branch is secure.

Keep the URLs that have traffic or links and prepare their equivalents on the new site. If there are custom SQL queries, list their differences and replace the ones that depend on old behaviour during the migration.

You may also find useful

Something wrong or out of date? Tell us and we will review it.