1055. Mysql8.0 high version data import 5.6 low version general solution

background

Today, I want to export the database files in mysql (8.0) of this machine to mysql (5.6) in a remote server. At the beginning, I used source to report a series of ERRORs. Since the amount of data is relatively large, I directly use graphical tools to import Well, connect to the remote database, build the library, and then run the SQL file, it is still unsuccessful, as follows:

[SQL] Query sql_bs start
[ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'
[ERR] /*
 Navicat Premium Data Transfer

Find the place where the error was reported at the beginning. When I saw this problem, I saw that it was an encoding problem. After modifying the encoding, the data was imported perfectly.


question

This error is that there is no "utf8mb4_0900_ai_ci" encoding, because the mysql version I use is: 5.6, and this version of mysql does not have this encoding method.

If you don't know your mysql version, you can check it on Baidu: How to query mysql version

Here is a way, in Navicat software –> New Query –> Inputselect version();

You can get your own mysql version.


solve

The first

Upgrade mysql version to 8.0

However, in general, it is because of special reasons that the version cannot be changed, so there is a second method:

the second

Modify the encoding method

        Open the sql file, replace all utf8mb4_0900_ai_ci in the file with utf8_general_ci, and replace utf8mb4 with utf8 at the same time . After processing the sql, re-import the sql file in the mysql library.


result

 

Guess you like

Origin blog.csdn.net/m0_54925305/article/details/130158830