MySQL Percona Galera Cluster with phpMyAdmin export

Galera Cluster have some limitations, for example all tables MUST have primary key.

In recent version, pxc_strict_mode is introduced to avoid unsupported features that can risk your data and server stability

One common trap is that SQL file exported with phpMyAdmin create index AFTER creating the table and inserting data.

During import, there is a transit state that table have no primary key and data need to insert to table, thus trigger the pxc_strict_mode error.

Solution 1 (If you have SUPER permission):

On the beginning of SQL file, add

but you will likely receive another error depend on Percona Cluster version:

SET GLOBAL will do the job but it require SUPER permission. Remember to turn it back to ENFORCING after import.

Solution 2 (If you can re-export):

Re-export SQL file with “IF NOT EXISTS (less efficient as indexes will be generated during table creation)” option

As stated in it’s description, it have the side effect to create keys during table creation

Solution 3:

Edit SQL file and move all INSERT statements after index creation.

Dumb but useful if you can’t do any of above


Reference: https://www.percona.com/doc/percona-xtradb-cluster/5.7/features/pxc-strict-mode.html

Leave a Reply

Your email address will not be published.