Exercise 3: mysql2 Has No Automatic Default — Possible Solution ==================================================================== WITHOUT charset SET ------------------------------ // db/client.ts const connection = await mysql.createConnection({ uri: process.env.DATABASE_URL, // charset intentionally omitted }); OBSERVED RESULT ------------------------------ Storing a page with a kanji title through this connection either stores the character incorrectly (visibly corrupted when read back) or, depending on the MySQL server's own default charset configuration, happens to work by coincidence rather than by any guarantee mysql2 itself provides - unlike Rails, there is no framework-level default forcing utf8mb4 specifically. WITH charset: 'utf8mb4' ADDED BACK ------------------------------ // db/client.ts const connection = await mysql.createConnection({ uri: process.env.DATABASE_URL, charset: 'utf8mb4', }); The same kanji title now stores and reads back correctly and reliably, regardless of whatever the underlying MySQL server's own default charset happens to be configured as. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly shows the difference between omitting and including charset: 'utf8mb4' on the mysql2 connection, and correctly explains why mysql2 offers no equivalent to Rails' own automatic utf8mb4 default - the outcome depends on explicit configuration, not a safe framework default.