Get started with Liquibase

Last updated: July 14, 2025

After you install Liquibase, get started with our tutorial and learn how Liquibase works.

With Liquibase, SQL statements [1] are declared as Liquibase changesets [2] in a changelog file [3].

how liquibase works 509x249

Liquibase [4] then uses the changelog to apply the changesets to target databases [5].

In this tutorial, you will use an example changelog to apply two rounds of updates to an H2 database that is included with the Liquibase installation files.

Before you begin

  • Install Liquibase.

Procedure

1

Copy the Liquibase examples directory from the installation directory to another location on your machine.

Inside the folder where you installed Liquibase, you'll see a folder called examples. Copy this folder and paste it into another location.

2

Start the h2 databse.

Liquibase packages an H2 database as a sandbox that you'll use to try out Liquibase. To run the database, you'll need to open a terminal at the location where you pasted your example folder and run:

liquibase init start-h2

The database console opens automatically in a browser on port 9090. The terminal includes the following output:

... Opening Database Console in Browser... Dev Web URL: http://192.168.56.1:8090/frame.jsp?jsessionid=d219f3d2012e078770943ef4c2cd0d11 Integration Web URL: http://192.168.56.1:8090/frame.jsp?jsessionid=d7ab638787c99dbfe9c8103883bee278

3

Run your changelog.

The examples folder you copied contains four additional folders inside: json, sql, xml, and yaml.

Choose one of these languages and open a terminal inside that folder. Then run:

liquibase update

Liquibase displays the following output:

Running Changeset: example-changelog::1::your.name Running Changeset: example-changelog::2::your.name Running Changeset: example-changelog::3::your.name Liquibase command 'update' was executed successfully.

When you run liquibase update, Liquibase looks at the liquibase.properties file in the examples folder to see where your changelog. If you open the liquibase.properties file, you'll see the line changeLogFile=example-changelog.

The example-changelog file in the examples folder contains a changelog with 3 changesets run during execution.

4

Confirm that the PERSON and COMPANY tables were added.

Now that your changeset has ran, you can refresh your h2 database to see the changes applied. You'll need to navigate back to your browser window where your database is running and refresh the page.

Get started with Liquibase 4
5

Using a text editor open the example-changelog file and add the following changeset to the end of the file.

--changeset your.name:4
ALTER TABLE person ADD nickname varchar(30);

6

Save and close example-changelog.

7

Enter the following command.

liquibase update

Liquibase displays the following output:

Running Changeset: example-changelog.yaml::4::your.name Liquibase command 'update' was executed successfully.

8

Confirm the update by refreshing the database console and verifying that the NICKNAME column has been added to the PERSON table.