--- name: feedback-mysql-collation description: Always use utf8mb4_unicode_ci for new tables — mixing collations breaks JOINs with MySQL error 1267 metadata: type: feedback originSessionId: 002fe81e-7e03-414d-b842-1f94f1390a22 --- All new tables in these MySQL databases must use `utf8mb4_unicode_ci` collation. Never use `utf8mb4_general_ci` or leave it at the server default without checking. **Why:** Mixing `utf8mb4_general_ci` and `utf8mb4_unicode_ci` in a JOIN causes MySQL error 1267: "Illegal mix of collations." This silently broke wishlist.php and reviews.php on tomsjavajive.com — pages returned 500 with no visible error until a diagnostic script revealed the PDO exception. Fixed by running `ALTER TABLE x CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci` on the mismatched tables. **How to apply:** - When writing `CREATE TABLE`, always include `COLLATE utf8mb4_unicode_ci` - When checking an existing table: `SHOW CREATE TABLE tablename\G` — look at the COLLATE line - Fix a bad table: `ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci` - Affected tables on tomsjavajive.com that were wrong (now fixed): wishlist, loyalty_transactions, loyalty_tiers, product_types, loyalty_settings