I want to alter a table from INNODB to MEMORY ENGINE.
So I typed this command:
alter table sns ENGINE=MEMORY;
Then the MySQL shows
The max size for the memory table is set on creation and altering and based on the max_heap_table_size value.
So when you want to raise the max size for an existing memory table you can change the max_heap_table_size and then apply it by altering the table to the same storage engine.
Example:
# Raise max size to 4GB
SET max_heap_table_size = 1024 * 1024 * 1024 * 4;
# If already a memory table, the alter will not change anything.
# Only apply the new max size.
ALTER TABLE table_name ENGINE=MEMORY;
Misunderstanding regarding tmp_table_size
The tmp_table_size variable only determines the max size for internal memory tables. Not user-defined.
As stated in the MySQL docs:
The maximum size of internal in-memory temporary tables. This variable does not apply to user-created MEMORY tables.