Unknown collation: ‘utf8mb4_0900_ai_ci‘

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: Unknown collation: ‘utf8mb4_0900_ai_ci‘

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

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

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

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

一、将文件中的所有
utf8mb4_0900_ai_ci 替换为 utf8_general_ci
utf8mb4 替换为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;

这样表单就创建成功了


相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
SQL 关系型数据库 MySQL
MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
|
SQL 关系型数据库 MySQL
【MySQL异常解决】MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
【MySQL异常解决】MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
494 0
|
SQL 关系型数据库 MySQL
解决:[Err] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci‘
记录如何结局:[Err] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci’这个问题
472 1
解决:[Err] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci‘
|
关系型数据库 MySQL 数据库
nivicat复制mysql数据库[Err] [Dtf] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'错误
问题的原因是两个数据库待转移的表的字符格式不能被被转移数据库识别。例如mysql8的utf8mb4_0900_ai_ci格式再mysql5中就不支持。就需要更改数据库字符编码和各个varchar等字段的编码方式
257 0
nivicat复制mysql数据库[Err] [Dtf] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'错误
|
关系型数据库 MySQL 数据库
mysql报错Unknown collation: utf8mb4_0900_ai_ci
在我们使用高版本mysql的时候,比如mysql8,到mysql5.7 恢复就报错,比如下面这样的错误:
mysql报错Unknown collation: utf8mb4_0900_ai_ci
|
关系型数据库 MySQL 数据库
mysql导入报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’
mysql导入报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’
mysql导入报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’
|
4天前
|
机器学习/深度学习 人工智能 自然语言处理
当前AI大模型在软件开发中的创新应用与挑战
2024年,AI大模型在软件开发领域的应用正重塑传统流程,从自动化编码、智能协作到代码审查和测试,显著提升了开发效率和代码质量。然而,技术挑战、伦理安全及模型可解释性等问题仍需解决。未来,AI将继续推动软件开发向更高效、智能化方向发展。
|
8天前
|
机器学习/深度学习 人工智能 自然语言处理
AI在医疗领域的应用及其挑战
【10月更文挑战第34天】本文将探讨人工智能(AI)在医疗领域的应用及其面临的挑战。我们将从AI技术的基本概念入手,然后详细介绍其在医疗领域的各种应用,如疾病诊断、药物研发、患者护理等。最后,我们将讨论AI在医疗领域面临的主要挑战,包括数据隐私、算法偏见、法规合规等问题。
28 1
|
6天前
|
机器学习/深度学习 人工智能 算法
AI在医疗领域的应用与挑战
本文探讨了人工智能(AI)在医疗领域的应用,包括其在疾病诊断、治疗方案制定、患者管理等方面的优势和潜力。同时,也分析了AI在医疗领域面临的挑战,如数据隐私、伦理问题以及技术局限性等。通过对这些内容的深入分析,旨在为读者提供一个全面了解AI在医疗领域现状和未来发展的视角。
35 10
|
7天前
|
机器学习/深度学习 人工智能 监控
探索AI在医疗领域的应用与挑战
本文深入探讨了人工智能(AI)在医疗领域中的应用现状和面临的挑战。通过分析AI技术如何助力疾病诊断、治疗方案优化、患者管理等方面的创新实践,揭示了AI技术为医疗行业带来的变革潜力。同时,文章也指出了数据隐私、算法透明度、跨学科合作等关键问题,并对未来的发展趋势进行了展望。

热门文章

最新文章