mysql导入备份.sql文件时报错总结(还有待完善)

时间:2022-09-05 12:03:06

错误1:ERROR Unknown character set: 'utf8mb4'

  utf8mb4编码集支持了表情符号,相信处理过社交网络数据的人都有了解。这个mysql5.5以后支持了utf8mb4编码集,所以只能卸载5.1,升级5.5

  在mysql my.cnf设置default-character-set = utf8mb4,在每个[]里都设置utf8mb4,或者在此不设置,在建数据库或数据表的时候设置更方便,更高效

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'

 

错误2:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE,
  KEY `authorid` (`authorid`) USING BTREE,
  KEY `dateline` (`datel' at line 24

  经查找是mysql版本的问题,导入的库是 server version: 5.0.18,导出的库5.1.45. 打开导出的mysql文件,找到类似

KEY `authorid` (`authorid`) USING BTREE

  修改成

KEY `authorid`USING BTREE(`authorid`)