mysql -h$1 -P$2 -u$3 -p$4 -D$5 -s -N -e  " source$TAB_ONLY_LIST"

发现一个语句报错,整个过程就失败了。


增加--force 或-f依旧报错

mysql -h$1 -P$2 -u$3 -p$4 -D$5 -s -N -f -e  " source$TAB_ONLY_LIST"


网上查了一下,说这不是bug,解决方案是

mysql -h$1 -P$2 -u$3 -p$4 -D$5 -s -N -f <"$TAB_ONLY_LIST"


https://bugs.mysql.com/bug.php?id=533

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

--force is intended to be used in Batch Mode only. I.e. like:

mysql --force < myscript.sql

# Unix style
cat myscript.sql | mysql --force

# Windows style
type myscript.sql | mysql --force

-e "" is intened to send Single query or command that's why --force does not make much sence for it. Single query can either succeed or fail. Maning of --force is to continue executing batch of queries even if some of them fail. Without it mysql will stop after first error.

Logo

更多推荐