Overview
MySQL is the world’s most popular open-source relational database. Zequel provides full support for MySQL through the officialmysql2 driver (v3.11.5).
Supported Versions
- MySQL 5.7+
- MySQL 8.0+
- MySQL 8.1+
- MySQL 8.2+
- MySQL 8.3+
Connection
Basic Connection
Connection String Format
SSL/TLS Configuration
MySQL supports SSL connections with certificate validation:- Disable: No SSL encryption
- Prefer: Try SSL first, fallback to non-SSL
- Require: Require SSL connection
- Verify-CA: Verify certificate authority
- Verify-Full: Verify CA and hostname
Features
Databases & Tables
- Create, rename, and drop databases
- Full table management with CREATE, ALTER, DROP
- Table comments and metadata
- Row count and size information
Data Types
Zequel supports all MySQL data types:- Numeric
- String
- Date/Time
- Other
- TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT
- DECIMAL, NUMERIC (with precision/scale)
- FLOAT, DOUBLE
- BIT
Indexes
- BTREE (default)
- HASH
- FULLTEXT for text search
- SPATIAL for geometry types
- Unique and composite indexes
- Primary key indexes
Constraints
- Primary keys with AUTO_INCREMENT
- Foreign keys with referential actions:
- ON UPDATE: CASCADE, SET NULL, RESTRICT, NO ACTION
- ON DELETE: CASCADE, SET NULL, RESTRICT, NO ACTION
- Unique constraints
- NOT NULL constraints
Stored Procedures & Functions
- Create and execute stored procedures
- User-defined functions
- Parameter support (IN, OUT, INOUT)
- Language: SQL
Triggers
- Timing: BEFORE, AFTER
- Events: INSERT, UPDATE, DELETE
- FOR EACH ROW execution
Views
- Create and manage views
- CREATE OR REPLACE VIEW support
- Rename views using RENAME TABLE
Events (Scheduler)
Manage scheduled tasks:- ONE TIME events with AT timestamp
- RECURRING events with EVERY interval
- Event status: ENABLED, DISABLED
- ON COMPLETION: PRESERVE, NOT PRESERVE
Users & Privileges
- Create and drop users
- User@host combinations
- Password management
- Privilege viewing (requires elevated permissions)
MySQL-Specific Features
Charset & Collation
Manage character sets and collations:- View available charsets (utf8mb4, latin1, etc.)
- View collations for each charset
- Set table charset:
ALTER TABLE tbl CONVERT TO CHARACTER SET utf8mb4 - Set database charset:
ALTER DATABASE db CHARACTER SET utf8mb4
Partitions
View and manage table partitions:- RANGE partitioning
- LIST partitioning
- HASH partitioning
- KEY partitioning
- View partition metadata (rows, size, compression)
Storage Engines
MySQL supports multiple storage engines:- InnoDB (default) - ACID transactions, foreign keys
- MyISAM - Fast reads, no transactions
- MEMORY - In-memory tables
- CSV - Comma-separated values
Column Positioning
MySQL allows specifying column order:Advanced Features
Transactions
Full ACID transaction support with InnoDB:Query Streaming
Large result sets are streamed using server-side cursors to prevent memory issues.Query Cancellation
Active queries can be cancelled usingKILL QUERY [connection_id].
Limitations
Docker Development
Zequel includes MySQL in Docker Compose:- Tables with various data types and engines
- Views and stored procedures
- Functions and triggers
- Events and scheduled tasks
- Partitioned tables
- Users with different privileges
Best Practices
- Use InnoDB for tables requiring transactions and foreign keys
- Enable SSL for production connections
- Use utf8mb4 charset for full Unicode support
- Set max_connections appropriately for your workload
- Monitor slow query log to identify performance bottlenecks
- Use prepared statements to prevent SQL injection