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
773 views
in Technique[技术] by (71.8m points)

mysql - Liquibase - how to generate a changelog for existing database

I'm trying to use liquibase for generating the changeLog, starting by snapshoting the current state of my database.

Environment details:

  • OS: Windows 7 32 x86,
  • Java JDK 1.7,
  • mysql jdbc driver from MySQL
  • liquibase 2.0.5.

I run the following from command line:

liquibase --driver=com.mysql.jdbc.Driver --changeLogFile=./structure.xml --url="jdbc:mysql://mysql.mysite.com" --username=<myuser> --password=<mypass> generateChangeLog

It runs fine, and generated the output file. But the output file just contains:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"/>

And no tables are created on my database (I was expecting the two tables used for tracking).

What am I missing?


EDITS

Yes, I'm referring to liquibasechanlog and liquibasechangelock tables. I know they should automatically appears on database. My question is why they aren't there. And yes, the provided user have the rights granted for doing such task.

And it is not an empty database. It has near 20 tables, 10 views, data...

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Just specify the database name with the --url flag like ZNK said:

  --url="jdbc:mysql://mysql.mysite.com/database_name_here"

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

...