mysql 5.7 -e选项在第1行出错:未知命令'\u'

时间:2021-12-01 22:51:36

This is the code I wrote on command line:

这是我在命令行上写的代码:

 mysql --user=root --password=root mydb --default-character-set=utf8 -e "set @arg1='[1002,2003,3304]';source run.sql"

However, it throws me this error:

然而,它给我这个错误:

ERROR at line 1: Unknown command '\U'

第1行错误:未知命令'\U'

I have tested if I remove set statement like this and run:

我已经测试了是否删除了这样的set语句并运行:

mysql --user=root --password=root mydb --default-character-set=utf8 -e "source run.sql"

The run script file executes.I know I can open the SQL file and change the source code to void this, but this problem is really annoying.

运行脚本文件执行。我知道我可以打开SQL文件并更改源代码以使其无效,但是这个问题真的很烦人。

Could anyone have any suggestions to solve this?

谁有什么建议可以解决这个问题?

1 个解决方案

#1


0  

Use ; at the end:

使用;最后:

... -e "set @arg1='[1002,2003,3304]';source run.sql;"

or change source by \.:

或改变来源。

... -e "set @arg1='[1002,2003,3304]';\. run.sql"

#1


0  

Use ; at the end:

使用;最后:

... -e "set @arg1='[1002,2003,3304]';source run.sql;"

or change source by \.:

或改变来源。

... -e "set @arg1='[1002,2003,3304]';\. run.sql"