#MariaDB
The MariaDB cube owns the server, its data directory and the databases created through it. It renders aegis-my.cnf (mode 0600) under mariadb.config_dir (/aegis/config/mariadb), keeps the data directory in mariadb.data_dir, the socket, pid and error log in mariadb.run_dir and mariadb.log_dir, and runs mariadb-install-db once when the data directory is empty. configure also creates the platform superuser from aegis.user / aegis.password.
The server runs as the keeper service aegis-mariadb under the mariadb.user account (default mysql). Administrative statements run as root over the Unix socket.
#Common commands
Cube operations share one wrapper: ✔ mariadb: <detail> on success, ✖ <message> on failure (exit 1), and {"ok": true, "cube": "mariadb", "result": "<detail>"} with global --json.
expose is the only verb that prints a block instead of that line.
| Verb | Effect |
|---|---|
configure | create the service account, render the config, initialise the data directory if empty, start, ensure the platform role |
validate | run mariadb-admin ping over the socket |
reload | run mariadb-admin reload: grants and tables are re-read |
status | read run/mariadb/mysqld.pid: running (pid N) or stopped |
start | start mariadbd through the keeper |
stop | SIGTERM, then SIGKILL after 15 seconds |
restart | stop, then start |
expose | print paths, port and socket, then publish the MariaDB tools |
help | print the command list with examples |
#configure
aegis cubes mariadb configureaegis --json cubes mariadb configure✔ mariadb: configuration written, server answers ping{"ok": true, "cube": "mariadb", "result": "configuration written, server answers ping"}#validate
aegis cubes mariadb validateaegis --json cubes mariadb validate✔ mariadb: server answers ping{"ok": true, "cube": "mariadb", "result": "server answers ping"}#reload
aegis cubes mariadb reloadaegis --json cubes mariadb reloadReloads the grant tables and flushes tables; it does not re-read the server configuration file. Use restart for a configuration change.
✔ mariadb: privileges reloaded{"ok": true, "cube": "mariadb", "result": "privileges reloaded"}#status
aegis cubes mariadb statusaegis --json cubes mariadb status✔ mariadb: running (pid 1701){"ok": true, "cube": "mariadb", "result": "running (pid 1701)"}#start
aegis cubes mariadb startaegis --json cubes mariadb start✔ mariadb: started (pid 1701){"ok": true, "cube": "mariadb", "result": "started (pid 1701)"}#stop
aegis cubes mariadb stopaegis --json cubes mariadb stop✔ mariadb: stopped (pid 1701){"ok": true, "cube": "mariadb", "result": "stopped (pid 1701)"}#restart
aegis cubes mariadb restartaegis --json cubes mariadb restart✔ mariadb: stopped (pid 1701), started (pid 1738){"ok": true, "cube": "mariadb", "result": "stopped (pid 1701), started (pid 1738)"}#expose
aegis cubes mariadb exposeaegis --json cubes mariadb exposecube mariadbinstalled /aegis/apps/data/mariadb/13.0configuration /aegis/config/mariadbstate running (pid 1701)pid 1701log /aegis/logs/mariadb/error.logconfig /aegis/config/mariadb/aegis-my.cnfdata /aegis/data/mariadbport 3306socket /aegis/run/mariadb/mysqld.sockpublished /aegis/bin/mariadb, /aegis/bin/mariadb-admin, /aegis/bin/mariadb-dump, /aegis/bin/mariadb-install-db, /aegis/bin/mariadbd{"ok": true, "cube": "mariadb", "installed": "/aegis/apps/data/mariadb/13.0", "configuration": "/aegis/config/mariadb", "state": "running (pid 1701)", "pid": "1701", "log": "/aegis/logs/mariadb/error.log", "config": "/aegis/config/mariadb/aegis-my.cnf", "data": "/aegis/data/mariadb", "port": "3306", "socket": "/aegis/run/mariadb/mysqld.sock", "published": "/aegis/bin/mariadb, /aegis/bin/mariadb-admin, /aegis/bin/mariadb-dump, /aegis/bin/mariadb-install-db, /aegis/bin/mariadbd"}#help
aegis cubes mariadb helpaegis cubes help mariadbℹ Mariadb — MariaDB server, its data directory and databasesCommands validate Check the configuration reload Reload the running daemon configure Prepare the data dir and write config start Start the server stop Stop the server status Show whether the server runs restart Restart the server expose Show where it is installed and how it runs databases Manage databasesThe list continues with users, tables and help, then the examples.
#Databases
#databases list
aegis cubes mariadb databases listaegis --json cubes mariadb databases listThe system schemas (mysql, information_schema, performance_schema, sys) are excluded.
✔ mariadb: aegis, shop{"ok": true, "cube": "mariadb", "result": "aegis, shop"}#databases create
aegis cubes mariadb databases create shopaegis --json cubes mariadb databases create analytics| Argument | Meaning |
|---|---|
name | database name: letters, digits, _, . and - |
Created with utf8mb4 / utf8mb4_unicode_ci, and aegis.user is granted all privileges on it for both localhost and 127.0.0.1.
✔ mariadb: created shop (owner aegis){"ok": true, "cube": "mariadb", "result": "created analytics (owner aegis)"}#databases drop
Destructive. Drops the database and every table in it. The system schemas are refused explicitly.
aegis cubes mariadb databases drop shopaegis --json cubes mariadb databases drop analytics| Argument | Meaning |
|---|---|
name | the database to drop |
✔ mariadb: dropped shop{"ok": true, "cube": "mariadb", "result": "dropped analytics"}#Users
A user is created on both local hosts, localhost and 127.0.0.1, because MariaDB treats them as separate accounts. Grants are always per database; the cube never hands out global privileges.
#users list
aegis cubes mariadb users listaegis --json cubes mariadb users list✔ mariadb: shop@localhost, shop@127.0.0.1{"ok": true, "cube": "mariadb", "result": "shop@localhost, shop@127.0.0.1"}#users add
aegis cubes mariadb users add shop --database shopaegis cubes mariadb users add app --database shop --database analytics| Option | Meaning |
|---|---|
name | account name: letters, digits, _, ., - |
--password | password; generated and printed when omitted |
--database | database to grant; repeatable |
✔ mariadb: user shop created; shop granted on shop{"ok": true, "cube": "mariadb", "result": "user app created; app granted on shop, app granted on analytics"}#users remove
Destructive. Drops the account on both hosts. Objects it created inside a database are not removed, but they become inaccessible through that account.
aegis cubes mariadb users remove shopaegis --json cubes mariadb users remove app| Argument | Meaning |
|---|---|
name | the account to drop |
✔ mariadb: user shop dropped{"ok": true, "cube": "mariadb", "result": "user app dropped"}#users password
aegis cubes mariadb users password shop --password 'new-secret'aegis --json cubes mariadb users password shop --password 'new-secret'| Option | Meaning |
|---|---|
name | the account |
--password | required new password |
✔ mariadb: password changed for shop{"ok": true, "cube": "mariadb", "result": "password changed for shop"}#users grant
aegis cubes mariadb users grant shop shopaegis --json cubes mariadb users grant app analytics| Argument | Meaning |
|---|---|
name | the account |
database | the database to grant |
✔ mariadb: shop granted on shop{"ok": true, "cube": "mariadb", "result": "app granted on analytics"}#users revoke
Destructive. Revokes all privileges on that database; the account itself stays.
aegis cubes mariadb users revoke shop shopaegis --json cubes mariadb users revoke app analytics✔ mariadb: shop revoked on shop{"ok": true, "cube": "mariadb", "result": "app revoked on analytics"}#Tables
#tables list
aegis cubes mariadb tables list shopaegis --json cubes mariadb tables list shop| Argument | Meaning |
|---|---|
database | the database to inspect |
Row estimates and data_length + index_length in megabytes.
✔ mariadb: orders (120 rows, 0.2 MB); sessions (12 rows, 0.0 MB){"ok": true, "cube": "mariadb", "result": "orders (120 rows, 0.2 MB); sessions (12 rows, 0.0 MB)"}#tables check
aegis cubes mariadb tables check shopaegis cubes mariadb tables check shop orders sessions| Argument | Meaning |
|---|---|
database | the database |
table | optional table names; all tables when omitted |
Runs CHECK TABLE once per table and names the failing table in the error.
✔ mariadb: check done on 5 tables in shop{"ok": true, "cube": "mariadb", "result": "check done on 2 tables in shop"}#tables repair
Destructive.
REPAIR TABLErewrites the table and can drop rows it cannot read. It is for crash damage, not routine maintenance.
aegis cubes mariadb tables repair shopaegis cubes mariadb tables repair shop ordersOptions are the same as tables check.
✔ mariadb: repair done on 1 tables in shop{"ok": true, "cube": "mariadb", "result": "repair done on 1 tables in shop"}#tables optimize
aegis cubes mariadb tables optimize shopaegis cubes mariadb tables optimize shop ordersOPTIMIZE TABLE rewrites the table and reclaims space; it takes an exclusive lock on each table for the duration.
✔ mariadb: optimize done on 5 tables in shop{"ok": true, "cube": "mariadb", "result": "optimize done on 1 tables in shop"}#tables analyze
aegis cubes mariadb tables analyze shopaegis --json cubes mariadb tables analyze shopRefreshes index statistics without rewriting data.
✔ mariadb: analyze done on 5 tables in shop{"ok": true, "cube": "mariadb", "result": "analyze done on 5 tables in shop"}