MySQL Data Types in MySQL
From the MySQL Advanced Features cheat sheet · MySQL Data Types & Storage · verified Jul 2026
MySQL Data Types
Common data types and their MySQL specifics
sql
-- Numeric types
INT -- 4-byte integer
BIGINT -- 8-byte integer
DECIMAL(10,2) -- Exact decimal
FLOAT / DOUBLE -- Floating point
BIT(8) -- Bit values
-- String types
VARCHAR(255) -- Variable length (max 65,535)
CHAR(10) -- Fixed length
TEXT -- 65,535 chars
MEDIUMTEXT -- 16 MB
LONGTEXT -- 4 GB
-- Date/Time types
DATE -- YYYY-MM-DD
TIME -- HH:MM:SS
DATETIME -- YYYY-MM-DD HH:MM:SS
TIMESTAMP -- Auto-update capable
YEAR -- Year value
-- DETAILED_TAB:
-- AUTO_INCREMENT
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) UNIQUE,
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP
);
-- ENUM and SET
CREATE TABLE products (
status ENUM('active', 'inactive', 'pending'),
tags SET('new', 'sale', 'featured')
);
-- Binary types
BINARY(16) -- Fixed binary (UUID)
VARBINARY(255) -- Variable binary
BLOB, MEDIUMBLOB, LONGBLOB -- Binary objects🟢 Essential - Choose right type for storage efficiency
💡 VARCHAR(255) is optimal for indexing
📌 TIMESTAMP has 2038 limit, use DATETIME for future dates
⚡ ENUM is fast but hard to modify later
⚠️ Since 8.0.13 TEXT/BLOB defaults need expression syntax: DEFAULT ('x')
datatypesmysql