阅读背景:

mysql source 忽略错误继续执行

来源:互联网 

mysql -h

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
https://www.mysql.com/documentation/ and the instructions on
how to report a bug at https://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.


-P -u -p -D -s -N -e  " source$TAB_ONLY_LIST"mysql -h

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
https://www.mysql.com/documentation/ and the instructions on
how to report a bug at https://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.


-P -u -p -D -s -N -e  " sour




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: