[Unknown collation: 'utf8mb4_0900_ai_ci' appears when Navicat imports MySQL sql files or Transfer data, resulting in incomplete data import. Perfect solution! ! 】

Unknown collation: 'utf8mb4_0900_ai_ci' appears when Navicat imports MySQL sql files or Transfer data, resulting in incomplete data import. Perfect solution! !


foreword

For some reason, I need to transfer (transfer) the database information of my local MySQL (version: 8.0) to my cloud server MySQL (version: 5.7.35), and the following error message appears on it (unknown character set collation) .

[ERR] 1273 - Unknown collation: ‘utf8mb4_0900_ai_ci’

Later, after being reminded by a friend, it was found that the version of the database was not uniform and version 5.7.35 did not support the utf8mb4_0900_ai_ci character set sorting rules of version 8.0 and above. MySQL version 5.7 did not include the utf8mb4_0900_ai_ci sorting rules of utf8mb4 character set of version 8.0 and above. , so when performing data transfer and data dump (from 8.0 and above to lower versions), pay attention to changing the collation of the character set to a collation that is compatible with the lower version.

1. The cause of the problem:

The MySQL 8.0 version added the utf8mb4_0900_ai_ci collation, but the lower version did not have this collation, so the 1273 error occurred.
Problems with character sets and collations


2. My cloud server MySQL uses version 5.7.35 without this sorting rule, so everyone knows the problem!


Collation does not support utf8mb4_0900_ai_ci

Two, the solution

1. Export the original data as a .sql file. Open the exported sql file with Notepad or other editable tools, then press and hold Ctrl + F, take win11 as an example, click the replace button to replace utf8mb4_0900_ai_ci with the utf8mb4_general_ci collation recognized by version 5.7 .

insert image description here


2. After all changes are made, the data can be imported into our database lower than version 8.0!


insert image description here


Summarize

Summarize a little experience every day, and there will be quantitative results!

Guess you like

Origin blog.csdn.net/qq_45973421/article/details/129992885