1.测试插入脚本
-
mysql> ALTER TABLE testtab CONVERT TO CHARACTER SET utf8mb4;
-
Query OK, 0 rows affected (0.34 sec)
-
Records: 0 Duplicates: 0 Warnings: 0
-
-
mysql> alter table testtab modify column `contents` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
Query OK, 0 rows affected (0.36 sec)
-
Records: 0 Duplicates: 0 Warnings: 0
-
mysql> show create table testtab\G;
*************************** 1. row ***************************
Table: testtab
Create Table: CREATE TABLE `testtab` (
`contents` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)
运行插入脚本
检查数据
MySQL [test]> select * from testtab;
+-----------+
| contents |
+-----------+
| |
| |
| ????hello | --插进去,因为没有前端测试,不知道是乱码还是正常的
+-----------+
3 rows in set (0.00 sec)