mysqldump: Got error: 1066: Not unique table/alias: 'table_name' when using LOCK TABLES

发布时间 2023-06-21 00:41:35作者: 一只桔子2233

1、前言

因旧项目情况,mysql数据库区分大小写lower_case_table_names=0
现进行重构,重构数据库中,定时任务表是以 QRTZ_ 开头的,故需要不区分大小写,lower_case_table_names=1
修改完my.cnf配置文件,并重启数据库服务后,出现了两张相同的表,一个是小写字母的,一个是大写字母的
使用时倒是没影响,但是使用mysqldump备份数据库时报错
mysqldump: Got error: 1066: Not unique table/alias: 'table_name' when using LOCK TABLES

2、跳过锁表 --skip-lock-tables

mysqldump -h127.0.0.1 -uroot -p"root" --skip-lock-tables -E -R test1 | gzip > /data/db/test1_2023_06_21_00_00_00.sql.gz