When upgrading batch sql scripts, due to various non-standard writing and non-repeatable execution, we usually hope that the sql script will not be terminated after an error occurs, but the execution will be completed. Although these problems can be solved by writing repeatable mysql stored procedures such as add_column/drop_column, in many cases, the ready-made version will take a long time to transition, so this requirement is still necessary.
It’s actually very simple, just add the --force command line option, as follows:
mysql -uroot -ppassword - -force [db] < patch.sql
The above is the entire implementation method of mysql batch file continued execution after an error brought to you by the editor. I hope you will support it~