转载:【MYSQL】MYSQL报错解决方法: Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8M B4 in a future release." - LiliP - 博客园 (cnblogs.com)MySQL的存储引擎(二)解决Warning Code : 3719 'utf8' is currently an alias for the character set UTF8MB3,... - 别看窗外的世界 - 博客园 (cnblogs.com)
知识点:(19条消息) MySQL的utf8与utf8mb4编码,以及utf8_bin、utf8_general_ci编码区别_mysql utf8_bin_zch981964的博客-优快云博客
Mysql 更改字符集 - 简书 (jianshu.com)
(19条消息) mysql中的utf8与utf8mb4_mysql utf8 utf8mb4_raoxiaoya的博客-优快云博客
报错:-- Table struct' at line 16
'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET FOREIGN_KEY_CHECKS = 0' at line 2
原因数据库的字符集错误:
查看:SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
如下:
把utf8mb4_0900_ai_ci修改为utf8mb4。
utf8_general_ci修改为utf8
修改前 =
'CREATE DATABASE IF NOT EXISTS database_name DEFAULT CHARSET utf8 COLLATE utf8_general_ci;'
修改后 =
'CREATE DATABASE IF NOT EXISTS database_name DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci;'
相关知识补充
UTF8MB4与UTF8MB3的区别介绍:https://dev.mysql.com/doc/refman/5.6/en/charset-unicode-utf8mb4.html