init start-h2
The init start-h2
command starts the in-memory H2 database included in the Liquibase installation package to get started and test how Liquibase works. It is available in Liquibase 4.7.0 and later.
If you run the liquibase init project
command, you can use H2 only with one of the following options:
- Creating the Liquibase project with the default values [Y].
- Customizing the values [C] but keeping the default URL, username, and password.
The H2 database console opens automatically in a browser on port 9090 and requires a new command line or terminal window.
Syntax
To start the H2 database, open a new terminal window and run the following command:
liquibase init start-h2
To continue running commands, use another terminal window.
Detached mode in flow files
In Liquibase 4.29.0 and later, you can run the init start-h2
command in a detached mode. Detached mode is useful if you want to run the init start-h2
command within a flow file via the flow
command. This allows Liquibase to continue processing actions in the file. For example:
stages:
Default:
actions:
- type: liquibase
command: init start-h2
cmdArgs: {detached: true}
- type: liquibase
command: update
cmdArgs: {changelog-file: example-changelog.sql}
Then you can successfully run the flow
command to run these actions:
liquibase flow
Command parameters
Attribute | Definition | Requirements |
---|---|---|
|
Network address to bind to. Default: |
Optional |
|
Port to run h2 database on. Default: |
Optional |
|
Liquibase 4.29.0+. When set to |
Optional |
|
Whether to open a browser to the database's web interface. Default: |
Optional |
|
Password to use for created h2 user. Default: |
Optional |
|
Username to create in h2. Default: |
Optional |
|
Port to run h2's web interface on. Default: |
Optional |
Attribute | Definition | Requirements |
---|---|---|
|
Network address to bind to. Default: |
Optional |
|
Port to run h2 database on. Default: |
Optional |
|
Liquibase 4.29.0+. When set to |
Optional |
|
Whether to open a browser to the database's web interface. Default: |
Optional |
|
Password to use for created h2 user. Default: |
Optional |
|
Username to create in h2. Default: |
Optional |
|
Port to run h2's web interface on. Default: |
Optional |
Attribute | Definition | Requirements |
---|---|---|
|
Network address to bind to. Default: |
Optional |
|
Port to run h2 database on. Default: |
Optional |
|
Liquibase 4.29.0+. When set to |
Optional |
|
Whether to open a browser to the database's web interface. Default: |
Optional |
|
Password to use for created h2 user. Default: |
Optional |
|
Username to create in h2. Default: |
Optional |
|
Port to run h2's web interface on. Default: |
Optional |
Attribute | Definition | Requirements |
---|---|---|
|
Network address to bind to. Default: |
Optional |
|
Port to run h2 database on. Default: |
Optional |
|
Liquibase 4.29.0+. When set to |
Optional |
|
Whether to open a browser to the database's web interface. Default: |
Optional |
|
Password to use for created h2 user. Default: |
Optional |
|
Username to create in h2. Default: |
Optional |
|
Port to run h2's web interface on. Default: |
Optional |
Attribute | Definition | Requirements |
---|---|---|
|
Network address to bind to. Default: |
Optional |
|
Port to run h2 database on. Default: |
Optional |
|
Liquibase 4.29.0+. When set to |
Optional |
|
Whether to open a browser to the database's web interface. Default: |
Optional |
|
Password to use for created h2 user. Default: |
Optional |
|
Username to create in h2. Default: |
Optional |
|
Port to run h2's web interface on. Default: |
Optional |
Related links
For more information about using Liquibase and H2, see the following pages: