The server refuses ALTER TABLE operations that attempt to change the encryption attribute using the INPLACE algorithm.
ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE (MySQL error 3187) appears when ALTER TABLE tries to turn encryption on or off with ALGORITHM=INPLACE. Use ALGORITHM=COPY or omit the encryption change to resolve the issue.
ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE
MySQL raises error 3187 when an ALTER TABLE statement attempts to modify the table encryption attribute while also requesting the INPLACE algorithm. The server added this protection in MySQL 5.7.13 to avoid data corruption because encryption metadata cannot be rewritten safely in place.
The message usually appears during schema migrations where ALGORITHM=INPLACE is used by default for speed. Understanding why INPLACE fails and how to switch strategies is critical for completing the change without downtime.
The primary trigger is setting or removing ENCRYPTION='Y' or ENCRYPTION='N' in an ALTER TABLE command that forces or implies ALGORITHM=INPLACE. MySQL detects that encryption metadata must be rewritten and blocks the operation.
The error also emerges when tools such as pt-online-schema-change or gh-ost generate ALTER statements that default to INPLACE. Additional causes include attempting encryption changes on tables that use storage engines or row formats not compatible with in-place encryption conversion.
Remove the INPLACE request and allow MySQL to fall back to the COPY algorithm, or explicitly specify ALGORITHM=COPY. The COPY path rebuilds the table safely with the new encryption setting.
An alternative is to split the operation into two statements: first change encryption with ALGORITHM=COPY, then run any extra column or index changes with ALGORITHM=INPLACE.
Schema migration tools fail mid-deployment when they add ENCRYPTION='Y' to comply with data-at-rest policy. Update the tool template to append ALGORITHM=COPY.
Manual ALTER scripts copied from earlier versions succeed in development but fail in production because global innodb_default_encrypt_algorithm makes the server inject encryption metadata. Add ALGORITHM=COPY to the production script to guarantee success.
Always set ALGORITHM=COPY when altering ENCRYPTION unless you have verified support for in-place encryption changes in your exact MySQL version.
Test ALTER statements in a staging environment that matches production encryption settings and storage engines. Automate checks in CI to flag INPLACE operations on encrypted tables.
ER_TABLESPACE_ENCRYPTION_DISABLED (3180) appears when encryption is disabled at the tablespace level. Enable innodb_encrypt_tables or remove the ENCRYPTION clause.
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON (1845) signals other operations that cannot run INPLACE. Switch to ALGORITHM=COPY to bypass the restriction.
MySQL blocks any attempt to toggle ENCRYPTION while ALGORITHM=INPLACE is set or assumed.
Automation frameworks often add ALGORITHM=INPLACE for performance, triggering the error when encryption is introduced.
Certain storage engines and row formats cannot rewrite encryption metadata in place and force the server to reject the request.
Older versions never allow in-place encryption changes, so any attempt will fail until you upgrade or use COPY.
Raised when encryption is disabled at tablespace level but the ALTER statement requests it.
Indicates other ALTER TABLE subcommands are incompatible with INPLACE.
Thrown when trying online changes on virtual columns that do not support them.
COPY rebuilds the table by creating a new copy before swapping, so writes are blocked briefly at the end. Use pt-online-schema-change or partitions to minimize impact.
No. MySQL hard blocks in-place encryption changes in affected versions. You must use COPY or upgrade to a version that natively supports it.
Yes, toggling encryption off on an existing encrypted table with INPLACE also triggers error 3187. Use COPY to disable encryption safely.
Galaxy flags ALTER statements that mix ENCRYPTION and INPLACE in the SQL editor, suggesting ALGORITHM=COPY and letting you preview the generated DDL before execution.