Unknown collation: ‘utf8mb4_0900_ai_ci‘

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: 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;

这样表单就创建成功了


相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与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‘】的解决方案
659 0
|
SQL 关系型数据库 MySQL
解决:[Err] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci‘
记录如何结局:[Err] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci’这个问题
496 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等字段的编码方式
268 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’
|
6天前
|
机器学习/深度学习 人工智能 自动驾驶
企业内训|AI大模型在汽车行业的前沿应用研修-某汽车集团
本课程是TsingtaoAI为某汽车集团高级项目经理设计研发,课程全面系统地解析AI的发展历程、技术基础及其在汽车行业的深度应用。通过深入浅出的理论讲解、丰富的行业案例分析以及实战项目训练,学员将全面掌握机器学习、深度学习、NLP与CV等核心技术,了解自动驾驶、智能制造、车联网与智能营销等关键应用场景,洞悉AI技术对企业战略布局的深远影响。
135 97
|
11天前
|
机器学习/深度学习 人工智能 物联网
AI赋能大学计划·大模型技术与应用实战学生训练营——湖南大学站圆满结营
12月14日,由中国软件行业校园招聘与实习公共服务平台携手魔搭社区共同举办的AI赋能大学计划·大模型技术与产业趋势高校行AIGC项目实战营·湖南大学站圆满结营。
AI赋能大学计划·大模型技术与应用实战学生训练营——湖南大学站圆满结营
|
3天前
|
机器学习/深度学习 人工智能 自然语言处理
CogAgent-9B:智谱 AI 开源 GLM-PC 的基座模型,专注于预测和执行 GUI 操作,可应用于自动化交互任务
CogAgent-9B 是智谱AI基于 GLM-4V-9B 训练的专用Agent任务模型,支持高分辨率图像处理和双语交互,能够预测并执行GUI操作,广泛应用于自动化任务。
35 12
CogAgent-9B:智谱 AI 开源 GLM-PC 的基座模型,专注于预测和执行 GUI 操作,可应用于自动化交互任务
|
17天前
|
机器学习/深度学习 人工智能 算法
探索AI在医疗诊断中的应用与挑战
【10月更文挑战第21天】 本文深入探讨了人工智能(AI)技术在医疗诊断领域的应用现状与面临的挑战,旨在为读者提供一个全面的视角,了解AI如何改变传统医疗模式,以及这一变革过程中所伴随的技术、伦理和法律问题。通过分析AI技术的优势和局限性,本文旨在促进对AI在医疗领域应用的更深层次理解和讨论。
105 31