Storage Engines in MySQL
From the MySQL Advanced Features cheat sheet · MySQL Data Types & Storage · verified Jul 2026
Storage Engines
InnoDB vs MyISAM and other storage engines
sql
-- Check storage engine
SHOW TABLE STATUS WHERE Name = 'users';
SHOW ENGINES;
-- Create with specific engine
CREATE TABLE transactions (
id INT PRIMARY KEY,
amount DECIMAL(10,2)
) ENGINE=InnoDB; -- Default, supports transactions
CREATE TABLE logs (
id INT PRIMARY KEY,
message TEXT
) ENGINE=MyISAM; -- Fast, no transactions
-- Change storage engine
ALTER TABLE users ENGINE=InnoDB;
-- DETAILED_TAB:
-- InnoDB features (default)
• Transactions (ACID compliant)
• Foreign keys
• Row-level locking
• Crash recovery
• Better for write-heavy
-- MyISAM features
• Table-level locking only
• No transactions
• Smaller disk footprint
• Better for read-heavy
• Full-text indexing (older MySQL)
-- Memory engine
CREATE TABLE cache (
key_name VARCHAR(255) PRIMARY KEY,
value TEXT
) ENGINE=MEMORY; -- RAM storage, lost on restart
-- Convert all tables to InnoDB
SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;')
FROM information_schema.tables
WHERE engine = 'MyISAM' AND table_schema = 'your_db';🟢 Essential - InnoDB is default and recommended
💡 Use InnoDB for data integrity (transactions)
⚠️ MyISAM doesn't support foreign keys
📌 MEMORY engine loses data on restart
⚡ InnoDB has better crash recovery
storageenginesinnodb