[Mysql] Mysql Incorrect string value problem

1
Mysql Incorrect string value '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'course' at row 1

同:Mysql 插入中文错误:Incorrect string value: ‘\xE7\xA8\x8B\xE5\xBA\x8F…’ for column ‘course’ at row 1

解決方式

如果資料庫已經創建,則先刪除。

1
2
mysql> show databases;
mysql> drop database wrong_database;

再重新創建,並以 utf8mb4 為預設

1
mysql> CREATE DATABASE test_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×