报错如下:
COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4' Query OK, 0 rows affected
原因是我本地的数据库版本是8,服务的版本是5,所以出现了兼容问题,解决如下
把utf8mb4_0900_ai_ci 改为 utf8mb4_unicode_ci
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_block
-- ----------------------------
DROP TABLE IF EXISTS `t_block`;
CREATE TABLE `t_block` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL COMMENT '名称',
`title` varchar(255) NOT NULL COMMENT '标题',
`screenshot` varchar(255) NOT NULL,
`schema` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
`updated_at` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SET FOREIGN_KEY_CHECKS = 1;
解决