Merge pull request #20336 from colemanw/searchKitUseDefaultPagerSize
[civicrm-core.git] / CRM / Core / InnoDBIndexer.php
index fdd401eb8da980dc5c0859645f477b1e0efda5e8..e9d26997a007fc27306a2d83a4d68265e45d4148 100644 (file)
@@ -169,10 +169,17 @@ class CRM_Core_InnoDBIndexer {
     }
 
     // Note: this only works in MySQL 5.6,  but this whole system is intended to only work in MySQL 5.6
+    // Note: In MYSQL 8 the Tables have been renamed from INNODB_SYS_TABLES and INNODB_SYS_INDEXES to INNODB_TABLES and INNODB_INDEXES
+    $innodbTable = "innodb_sys_tables";
+    $innodbIndex = "innodb_sys_indexes";
+    if (version_compare($mysqlVersion, '8.0', '>=')) {
+      $innodbTable = "innodb_tables";
+      $innodbIndex = "innodb_indexes";
+    }
     $sql = "
-      SELECT i.name as index_name
-      FROM information_schema.innodb_sys_tables t
-      JOIN information_schema.innodb_sys_indexes i USING (table_id)
+      SELECT i.name as `index_name`
+      FROM information_schema.$innodbTable t
+      JOIN information_schema.$innodbIndex i USING (table_id)
       WHERE t.name = concat(database(),'/$table')
       AND i.name like '" . self::IDX_PREFIX . "%'
       ";