db:console
Introduction
db:console opens an interactive MariaDB console on the selected product’s database. It takes the credentials from the product’s environment, so you never type them.
splent db:console
It reads MARIADB_HOSTNAME, MARIADB_USER, MARIADB_PASSWORD and MARIADB_DATABASE from the environment the CLI loads, which is the product’s docker/.env, or deploy/.env while production is deployed. See Precedence in the CLI.
The password travels in MYSQL_PWD, so it never shows on the command line or in the process list.
Fixing what it reports
| Message | What to do |
|---|---|
❌ Missing required environment variables: and the list |
Run splent product:env --merge --dev to bring them into docker/.env |
❌ Could not open the MariaDB console (mariadb exited N). |
The database is down or unreachable. The message names the host and user it tried. Start it with splent product:up |
'mysql' is required but was not found on PATH. |
Neither client is installed where the command runs. Install the mariadb-client package |
It uses mariadb, or mysql when mariadb is not on the PATH. The CLI image and the production image both install mariadb-client.
Requirements
- A selected product. Without one it prints
No product selected. Run: splent product:select <name>and exits 1. - A reachable database.