Unknown collation: ‘utf8mb4_0900_ai_ci‘

爱你三千遍斯塔克 2024-06-13 14:01:04 阅读 94

今天在敲代码的时候遇到了一个这样的错误:

这里感谢大佬的文章,经过大佬的指定,问题终于解决了,文章链接在这里,感兴趣的伙伴可以进行参考:

Unknown collation: ‘utf8mb4_0900_ai_ci_unknown collation: 'utf8mb4_0900_ai_ci-CSDN博客

这里简单解释:可能是mysql中高版本的数据库导入低版本的mysql数据库产生的报错

一、将文件中的所有utf8mb4_0900_ai_ci 替换为 utf8_general_ciutf8mb4 替换为utf8

先贴一下源码:这里所有的内容,都进行替换就可以了

一条一条复制太复杂了,有什么办法一次性替换,有vscode,进行替换

我们就需要用ctrl+f快捷键,这样就可以使用查找所有的img,并将所有img替换成images,点击左边符号,下面就可以实现替换了。注意替换时不要有空格。

/* Navicat Premium Data Transfer Source Server : local Source Server Type : MySQL Source Server Version : 80029 Source Host : localhost:3306 Source Schema : ymzting Target Server Type : MySQL Target Server Version : 80029 File Encoding : 65001 Date: 07/05/2023 17:36:14*/SET NAMES utf8mb4;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for comment-- ----------------------------DROP TABLE IF EXISTS `comment`;CREATE TABLE `comment` ( `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `color` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `isuse` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of comment-- ----------------------------INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕!!!!!!!!!!', '0.00', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕1', '0.00', '#B42020', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕2', '0.00', '#52C827', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕3', '0.00', '#8311A0', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '0.00', '#DD1919', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '', '0.00', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '有时间的弹幕', '8.712107', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '发送弹幕', '4.633285', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '1111', '12.672615', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', 'wwww', '14.069479', '#9A1919', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕', '1.76306', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', 'websocket', '2.344148', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '111', '3.385441', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '弹幕', '5.381284', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '弹幕', '13.613529', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11111', '2.407239', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11111', '5.256298', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '1111', '2.059521', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11112222', '8.389185', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '测试', '2.234286', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '', '0', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '33333', '3.96462', '#782D2D', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '3254524', '2.795794', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '0.83545', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '7.72843', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '10.960832', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '13.756024', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '15.708912', '#000000', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '8.765993', '#000000', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '2.432202', '#C50B0B', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '6.952991', '#4429AF', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '8.168342', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '1111', '2.505749', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '1111', '0', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', 'wwww', '4.389952', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '测试能完结了吗', '3.683333', '#000000', '0');-- ------------------------------ Table structure for user-- ----------------------------DROP TABLE IF EXISTS `user`;CREATE TABLE `user` ( `id` int(0) NOT NULL AUTO_INCREMENT, `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, `role` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;-- ------------------------------ Table structure for video-- ----------------------------DROP TABLE IF EXISTS `video`;CREATE TABLE `video` ( `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, `label` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of video-- ----------------------------INSERT INTO `video` VALUES ('猫咪', 'cat', '宠物,猫,动物,可爱');INSERT INTO `video` VALUES ('狗狗', 'dog', '宠物,狗,动物,汪汪');INSERT INTO `video` VALUES ('大楼', 'build', '大楼,城市,建筑,景色');INSERT INTO `video` VALUES ('草地', 'grass', '自然,景色,草原,绿色');INSERT INTO `video` VALUES ('大鹅', 'goose', '动物,家畜,散养,凶猛');INSERT INTO `video` VALUES ('人', 'people', '人类,摄影,美景');INSERT INTO `video` VALUES ('很多车', 'manycar', '汽车,城市,生活');INSERT INTO `video` VALUES ('汽车', 'car', '汽车,奢侈');SET FOREIGN_KEY_CHECKS = 1;

更换的表单

/* Navicat Premium Data Transfer Source Server : local Source Server Type : MySQL Source Server Version : 80029 Source Host : localhost:3306 Source Schema : ymzting Target Server Type : MySQL Target Server Version : 80029 File Encoding : 65001 Date: 07/05/2023 17:36:14*/SET NAMES utf8;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for comment-- ----------------------------DROP TABLE IF EXISTS `comment`;CREATE TABLE `comment` ( `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `comment` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `color` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `isuse` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of comment-- ----------------------------INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕!!!!!!!!!!', '0.00', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕1', '0.00', '#B42020', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕2', '0.00', '#52C827', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕3', '0.00', '#8311A0', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '0.00', '#DD1919', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '', '0.00', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '有时间的弹幕', '8.712107', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '发送弹幕', '4.633285', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '1111', '12.672615', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', 'wwww', '14.069479', '#9A1919', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '测试弹幕', '1.76306', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', 'websocket', '2.344148', '#000000', '0');INSERT INTO `comment` VALUES ('dog', 'ymzting', '111', '3.385441', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '弹幕', '5.381284', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '弹幕', '13.613529', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11111', '2.407239', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11111', '5.256298', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '1111', '2.059521', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '11112222', '8.389185', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '测试', '2.234286', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '', '0', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '33333', '3.96462', '#782D2D', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '3254524', '2.795794', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '0.83545', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '7.72843', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '10.960832', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '13.756024', '#000000', '0');INSERT INTO `comment` VALUES ('build', 'ymzting', '啦啦啦啦啦啦啦啦啦', '15.708912', '#000000', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '8.765993', '#000000', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '2.432202', '#C50B0B', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '6.952991', '#4429AF', '0');INSERT INTO `comment` VALUES ('cat', 'ymzting', '猫猫', '8.168342', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '1111', '2.505749', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '1111', '0', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', 'wwww', '4.389952', '#000000', '0');INSERT INTO `comment` VALUES ('grass', 'ymzting', '测试能完结了吗', '3.683333', '#000000', '0');-- ------------------------------ Table structure for user-- ----------------------------DROP TABLE IF EXISTS `user`;CREATE TABLE `user` ( `id` int(0) NOT NULL AUTO_INCREMENT, `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `picture` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `role` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ------------------------------ Table structure for video-- ----------------------------DROP TABLE IF EXISTS `video`;CREATE TABLE `video` ( `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `label` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ------------------------------ Records of video-- ----------------------------INSERT INTO `video` VALUES ('猫咪', 'cat', '宠物,猫,动物,可爱');INSERT INTO `video` VALUES ('狗狗', 'dog', '宠物,狗,动物,汪汪');INSERT INTO `video` VALUES ('大楼', 'build', '大楼,城市,建筑,景色');INSERT INTO `video` VALUES ('草地', 'grass', '自然,景色,草原,绿色');INSERT INTO `video` VALUES ('大鹅', 'goose', '动物,家畜,散养,凶猛');INSERT INTO `video` VALUES ('人', 'people', '人类,摄影,美景');INSERT INTO `video` VALUES ('很多车', 'manycar', '汽车,城市,生活');INSERT INTO `video` VALUES ('汽车', 'car', '汽车,奢侈');SET FOREIGN_KEY_CHECKS = 1;

 这样表单就创建成功了



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。