
Running MySQL in Docker With a Data Volume That Persists
Run MySQL 8.4 in Docker with a named volume, environment variables, a custom config, health checks, initialization scripts and safe upgrades.
The workhorse behind half the web. Queries, quirks and storage-engine lore for keeping it quick, correct and out of the pager.

Run MySQL 8.4 in Docker with a named volume, environment variables, a custom config, health checks, initialization scripts and safe upgrades.

Install MySQL 8.4 LTS on macOS, Ubuntu and Windows: package sources, first start, the root account, secure setup and checks that the server works.

A beginner guide to getting a MySQL server running: choose a version, install, secure, connect, create users and fix the first errors.

Generate INSERT statements from a CSV without breaking on O'Neil or running a DROP TABLE hidden in a value. Batches of 1,000 loaded 193,708 rows in 1.6 s.

One timestamp exported as 09:30+00, 16:30+07 and 04:30-05, and dd.mm.yyyy that pandas read as 3 January. Fix dates and booleans in the query, not the session.

Export a 2,000,000 row table to CSV six ways: peak memory ranged from 11 MB to 2 GB, time from 1.6 s to 14 s. fetchall and pandas are the ones that run out.

INTO OUTFILE writes on the server and its popular recipe corrupts newlines and NULLs: 4 of 8 rows read back. A variant reads 7, a client script reads 8.

The same eight awkward rows exported from PostgreSQL, MySQL, SQLite, DuckDB and MongoDB, then read back: four tools return all 8, one recipe returns 4.

When a JSON column in PostgreSQL, MySQL or SQLite is enough, and when a document database such as MongoDB earns its place, with measured numbers.

Decode MySQL error 3140 Invalid JSON text and its relatives, including the backslash trap in SQL string literals that silently changes your JSON.

Enforce structure on a MySQL JSON column with JSON_TYPE checks and JSON_SCHEMA_VALID in CHECK constraints, with the draft 4 limits and the insert cost.

MariaDB's JSON is validated text and MySQL's is a binary type. What differs in storage, operators, indexes, errors and speed, measured on 200,000 rows.
We send one email when a new article is published. No spam.