简体   繁体   中英

Skip triggers while restoring MySQL dump using Linux command

I have a large dump(~50GB) of MySQL database(Multiple databases backup). I am restoring it to a new Server which is taking a long time. I think it is taking this much time because it is huge data. the command ( gunzip < 1922-1648-329-75_all-databases.sql.20220305-0000.gz | MySQL -u test -p) also working fine and it started importing. But after some time, I'm getting an error called "Unknown column 'id' in 'OLD'". I have troubleshot and found that this error is coming from one of the triggers in the backup file. I don't really need triggers on the new server. Is there a command-line option to use in MySQL which will allow me to skip the triggers while restoring the dump?

Below is the Restore Commane which I am using.

gunzip < 1922-1648-329-75_all-databases.sql.20220305-0000.gz | MySQL -u test -p

Recreate the dump if you can, using the --skip-triggers option. You will have to recreat them afterwards.

https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_triggers

There is no option available to disable the triggers on import.

rewrite your faulty trigger code.

you have an INSERT trigger with OLD in it, which is not supported.

Maybe it is acopy paste error, but such things must be made before making a backup runs.

the link below shows you how to select all triggers, this should help to find the problematic trigger

How do you list all triggers in a MySQL database?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM