0

I am using mysql 8.0.x and trying to use liquibase version 3.6.2 to apply change log.

When I try to update changelog via command line, it works fine with yaml format but sql format does not work for changeset.

Here is whole setup. command-to-run.bat file is the exact command I am trying to fire.

I think the problem is same as this, but the that solution is not working too. Their problem is the fomatting of file should be not be UTF-8 BOM format, though that issue is fixed but I tried to change the format and I am still having issue.

I am using the same sql file liquibase has given example with. The error I am getting is following

Unexpected error running Liquibase: 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 '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
liquibase.exception.MigrationFailedException: Migration failed for change set changelog-master.xml::third::akshay:
     Reason: liquibase.exception.DatabaseException: 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 '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:78)
        at liquibase.Liquibase.update(Liquibase.java:202)
        at liquibase.Liquibase.update(Liquibase.java:179)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1205)
        at liquibase.integration.commandline.Main.run(Main.java:191)
        at liquibase.integration.commandline.Main.main(Main.java:129)
Caused by: liquibase.exception.DatabaseException: 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 '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:356)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
        at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1229)
        at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1211)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:600)
        ... 7 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: 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 '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
        at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
        ... 12 common frames omitted


For more information, please use the --logLevel flag
Roland Weisleder
  • 9,668
  • 7
  • 37
  • 59
Akshay
  • 3,558
  • 4
  • 43
  • 77

0 Answers0