【问题标题】:Mysql break long query in multiple line queriesMysql在多行查询中中断长查询
【发布时间】:2021-01-30 23:34:40
【问题描述】:

我使用 MySQL docker 容器来开发应用程序。 我的应用程序成功连接到 MYSQL 并正确执行查询。

当我想对其执行多行查询时,我的问题就出现了。

例如:

-- liquibase format sql
--changeset alipour:13990724_1
select host,
   user,
   Select_priv
from user
where 1=1;

执行查询后出现以下错误:

ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--changeset alipour:13990724_1
select host,
   user,
   Select_priv
from' at line 1

我检查的方式,但得到了同样的错误:

  • 在数据源 URL 上使用 allowMultiQueries=true
  • 将查询保存在文件中,我通过 MySQL 命令对其进行了测试

我在我的应用程序中使用 spring boot 和 liquibase 进行数据库演进。

【问题讨论】:

  • 报错信息与查询不一致:提到--changeset alipour:13990724_1,查询中没有出现。
  • @GMB 感谢您的回复,--changeset alipour:13990724_1 是 liquibase sql 文件格式,应该放在第一位。
  • @GMB 没错,我应该在--changeset 之间加一个空格,正确的语法是-- changeset alipour:13990724_1 。这花了我一个小时的时间。非常感谢

标签: mysql spring-boot liquibase


【解决方案1】:

引起了问题。

感谢@GMB 的提示。

我变了

--changeset alipour:13990724_1

-- changeset alipour:13990724_1

问题解决了。

【讨论】:

    猜你喜欢
    • 2013-07-23
    • 2016-09-13
    • 1970-01-01
    • 2017-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-15
    相关资源
    最近更新 更多