Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
567 views
in Technique[技术] by (71.8m points)

mysql - Liquibase fails to update a sql file

I am using liquibase with mysql. I am using xampp: phpmyadmin to build my database. After I've built it, I export a sql file (So basically this ensures that the syntax is valid in the file). Then I try to update liquibase with the file:

java -jar C:UsersTalDesktopmysql_test
ode_modulesliquibaselibliquibase-4.0.0liquibase.jar --changeLogFile=C:UsersTalDesktopmysql_testliquibase
esourceinmates_1.sql --url=jdbc:mysql://localhost:3306/inmates --username=root --password= --classpath=C:UsersTalDesktopmysql_test
ode_modulesliquibaselibDriversmysql-connector-java-8.0.22.jar --driver=com.mysql.cj.jdbc.Driver update
  • According to liquibase documentation I did use the correct driver and classpath.
  • inmates_1.sql is the file generated in phpmyadmin which is valid one
  • Of course the url, username, password are correct
  • mysql version is: 10.4.17-MariaDB

But still, when I run this command above, I get an error:

Starting Liquibase at 22:02:44 (version 4.0.0-beta1 #6 built at 2020-04-20 18:23+0000)
Unexpected error running Liquibase: Migration failed for change set C:/Users/Tal/Desktop/mysql_test/liquibase/resource/inmates_1.sql::raw::includeAll:
     Reason: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'START TRANSACTION;
SET time_zone = "+00:00";

And very important, this line: START TRANSACTION; SET time_zone = "+00:00" which liquibase inform of invalid syntax, was generated by phpmyadmin.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...