mkdb start creates and starts a new database container. Run it without any flags to step through an interactive menu, or pass flags directly to skip the prompts — useful in scripts or when you want to recreate a specific setup quickly.
Flags
string
Database type to create. Accepts
postgres, pg, postgresql, mysql, mariadb, or redis.string
Name for the database. Used as the container display name and in the connection string.
string
Database image version to use. Defaults to
18 for PostgreSQL, latest for MySQL and Redis.string
Host port to bind the container to. If omitted, mkdb uses the database default port and automatically selects the next available port if it is already in use. If you specify a port that is already in use, mkdb returns an error.
string
Volume configuration for the container. Accepts
none (no persistence), named (stores data in ~/.local/share/mkdb/volumes/<name>), or a custom filesystem path (bind mount). If omitted, mkdb prompts you to choose.integer
default:"2"
Time to live in hours. The container is automatically cleaned up after this many hours. Default is
2.boolean
Reuse the settings from the last database you created. mkdb shows you the saved settings and asks you to confirm before proceeding.
boolean
Create the database without a username or password. See authentication below.
Smart prompting
mkdb start only prompts for values you have not already provided via flags. For example, if you pass --db mysql --name testdb, mkdb skips the database type and name prompts but still asks about volume configuration and authentication unless you specify those flags too.
Port handling
When you do not specify--port, mkdb uses the database default port (5432 for PostgreSQL, 3306 for MySQL, 6379 for Redis). If that port is already in use, mkdb finds the next available port automatically and prints a notice:
--port explicitly and that port is already in use, mkdb returns an error and exits. Automatic port selection checks up to 100 ports from the default.
Authentication
By default, mkdb prompts you to enable authentication. When enabled, it creates a user nameddbuser with a randomly generated 12-character alphanumeric password and displays the connection string after creation.
To skip the prompt, use --no-auth to create the database without a username or password:
Examples
Interactive mode — prompts for all options:Default credentials
When authentication is enabled, mkdb creates the following default user:
The password is displayed once after creation and stored encrypted using AES-256-GCM. Retrieve it any time with
mkdb creds get.