Skip to content

Commit 29b5e15

Browse files
Fotios Tsakiridisclaude
andcommitted
Fix MySQL 8.0+ charset collation
- Changed utf8mb4_unicode_ci to utf8mb4_0900_ai_ci (MySQL 8.0+ default) - Updated documentation to reflect MySQL 8.0+ defaults Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b888348 commit 29b5e15

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

config/global-context.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- Protected pages: `require 'auth_check.php';` at the TOP of every protected file
1818

1919
**Database:**
20-
- Charset: `utf8mb4` — supports emojis and all Unicode
20+
- Charset: `utf8mb4` with `utf8mb4_0900_ai_ci` collation (MySQL 8.0+ default)
2121
- Indexes: Add `INDEX` on columns used in WHERE/JOIN
2222
- Transactions: Use `beginTransaction/commit/rollBack` for related operations
2323

@@ -597,8 +597,8 @@ $pdo = new PDO($dsn, $_ENV['DB_USER'], $_ENV['DB_PASS'], [
597597
```
598598

599599
```sql
600-
-- Always use utf8mb4 for full Unicode support
601-
CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
600+
-- MySQL 8.0+ uses utf8mb4 and utf8mb4_0900_ai_ci by default
601+
CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
602602

603603
-- Table with proper constraints and indexes
604604
CREATE TABLE users (
@@ -612,7 +612,7 @@ CREATE TABLE users (
612612

613613
UNIQUE INDEX idx_email (email),
614614
INDEX idx_role (role)
615-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
615+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
616616
```
617617

618618
### 4.2 TRANSACTIONS

0 commit comments

Comments
 (0)