All tags
mariadb
Narrow down
Other tips29
- Tip
ALTER TABLE t ADD COLUMN z INT INVISIBLE;MariaDB INVISIBLE columns stay out of SELECT * and plain INSERTsHides a column from SELECT * and from inserts that do not name it.2 Dec 2026 - Tip
CREATE SEQUENCE s START WITH 100 INCREMENT BY 10;MariaDB CREATE SEQUENCE gives you numbers without AUTO_INCREMENTCreates a sequence object that hands out numbers, usable as a column default.2 Dec 2026 - Tip
CREATE OR REPLACE TABLE scratch (MariaDB CREATE OR REPLACE TABLE rebuilds a table in one statementCreates a table, replacing it if it already exists, so reruns of a script do not fail.2 Dec 2026 - Tip
mariadb --init-command="SET SESSION sql_mode='STRICT_ALL_TABLES'" mydbmariadb --init-command runs a statement every time you connectRuns one SQL statement automatically after the client connects, and again after a reconnect.2 Dec 2026 - Tip
mariadb-admin -u root -p extended-status --relative --sleep=10 \mariadb-admin in relative mode shows what the server is doing right nowTurns ever growing server counters into per interval numbers.1 Dec 2026 - Tip
ALTER USER 'app'@'localhost' ACCOUNT LOCK;Lock a MariaDB account for a while instead of dropping itBlocks logins for a user while keeping its password and grants.1 Dec 2026 - Tip
SHOW FULL PROCESSLIST;SHOW EXPLAIN shows the plan of a query that is still running in MariaDBReveals how a slow query is executing without waiting for it to finish.1 Dec 2026 - Tip
CREATE TABLE prices (A system versioned MariaDB table remembers every earlier rowLets you query what the data looked like at an earlier moment.1 Dec 2026 - Tip
my_print_defaults --mysqldmy_print_defaults shows which options your MariaDB server reads from filesShows which settings are picked up from all the option files together.1 Dec 2026 - Tip
mariadb --show-warnings -u root -p shop < data.sqlMake the mariadb client print warnings during an importSurfaces truncated and altered values that a quiet import would hide.1 Dec 2026 - Tip
mariadb -e 'CREATE DATABASE IF NOT EXISTS blog'The one-database option of mariadb restores a single database from a full dumpPulls one database out of a full server dump without touching the others.30 Nov 2026 - Tip
mariadb-dump --no-create-info --insert-ignore shop orders > orders-rows.sqlA mariadb-dump with INSERT IGNORE and no CREATE merges rows into a live database tableDumps only rows as INSERT IGNORE, so loading them adds missing rows and keeps the rest.30 Nov 2026 - Tip
SELECT table_schema, table_name,One information_schema query lists the biggest tables in your database serverShows which tables use the most disk space, data and indexes together, in megabytes.30 Nov 2026 - Tip
CHECKSUM TABLE shop.orders;CHECKSUM TABLE tells you whether two database copies of a table hold the same rowsCompares a table on two servers with one number instead of dumping and diffing it.30 Nov 2026 - Tip
SHOW TABLE STATUS LIKE 'orders'\GData_free in SHOW TABLE STATUS tells you whether OPTIMIZE TABLE will shrink a database tableChecks how much reclaimable space a table holds before rebuilding it to shrink it.30 Nov 2026 - Tip
MariaDB [shop]> tee /tmp/fix-orders.logTee in the mariadb client logs your whole database session to a fileRecords every query and result of an interactive session in a log file.30 Nov 2026 - Tip
MariaDB [shop]> pager less -SPager less -S in the mariadb client keeps wide database tables readableSends query output through less without line wrapping, so wide tables stay aligned.30 Nov 2026 - Tip
ANALYZE SELECT * FROM orders WHERE customer = 'ann';ANALYZE SELECT runs the query and shows real row counts next to the database estimatesRuns a query and prints the plan with actual rows read beside the optimizer's guess.30 Nov 2026 - Tip
SET STATEMENT max_statement_time = 5 FORMax_statement_time stops a runaway database query after a set number of secondsSets a time limit so a slow query is aborted instead of running for hours.30 Nov 2026 - Tip
ALTER TABLE orders ALTER INDEX idx_customer IGNORED;An IGNORED index lets you test dropping a database index without dropping itHides an index from the optimizer so you can see what breaks before you drop it.30 Nov 2026 - Tip
SHOW CREATE TABLE orders\GSHOW CREATE TABLE gives you the exact statement that rebuilds a database tablePrints a complete CREATE TABLE statement with keys, engine and charset for one table.30 Nov 2026 - Tip
SHOW SESSION STATUS LIKE 'Handler_read%';Handler_read_rnd_next shows when a database query reads the whole tableCounts the rows a query actually read, so full table scans stand out right away.30 Nov 2026 - Tip
mariadb --prompt='\u@\h [\d]> ' shopA custom mariadb prompt shows user, host and database before you run a queryPuts the login user, server host and current database in the client prompt.30 Nov 2026 - Tip
mariadb --auto-vertical-output -u root -p appdbmariadb --auto-vertical-output switches wide results to one field per lineMakes the MariaDB client print wide query results vertically, one column per line.28 Nov 2026 - Tip
mariadb-check -u root -p --all-databases --check-only-changedmariadb-check --check-only-changed checks all tables from the command lineChecks every MariaDB table from the shell, optionally only those changed since the last check.28 Nov 2026 - Tip
mariadb -B -N -e "SELECT id, email FROM users WHERE active" appdbmariadb -B -N -e prints query results as bare tab-separated rows for scriptsRuns one query and prints plain tab-separated rows without borders or a header line.28 Nov 2026 - Tip
SHOW GRANTS FOR 'app'@'localhost';SHOW GRANTS FOR checks what a database user can really doLists the exact privileges of one MySQL or MariaDB account so you can spot too-wide rights.3 Mar 2026 - Tip
SET GLOBAL slow_query_log = 'ON';set slow_query_log at runtime to catch slow database queries without a restartStarts logging slow statements on a running MySQL or MariaDB server and shows where the file lives.2 Mar 2026 - Tip
mysql -e 'SHOW FULL PROCESSLIST'SHOW FULL PROCESSLIST shows the whole query of every running database threadLists every running thread of a MySQL or MariaDB server with its complete SQL text, and lets you stop one.21 Feb 2026
Storage4
- Tip
mariadb-dump --skip-extended-insert shop orders > orders.sqlskip-extended-insert puts one row per line so database dumps diff cleanlyWrites one INSERT per row so diff and grep show exactly which rows changed.30 Nov 2026 - Tip
mariadb-dump --databases shop blog > shop-blog.sqlmariadb-dump with the databases option writes CREATE DATABASE into the dump for youMakes a dump that creates and selects its own database when you restore it.30 Nov 2026 - Tip
mariadb-dump --single-transaction \mariadb-dump --ignore-table-data keeps a table's structure and leaves out its rowsDumps a MariaDB database but keeps only the structure of the tables you name.28 Nov 2026 - Tip
mariadb-dump --single-transaction --where="created_at >= '2026-01-01'" appdb orders > orders-2026.sqlmariadb-dump --where exports only the rows that match a conditionDumps only the table rows that match a SQL condition instead of the whole table.28 Nov 2026
Docker2
- Tip
services:Healthcheck.sh in the MariaDB image checks that the database is really readyUses the check script that ships in the MariaDB image instead of a hand-made mysqladmin line.30 Nov 2026 - Tip
services:MARIADB_AUTO_UPGRADE=1 lets the MariaDB image upgrade the database system tables itselfHas the official image run mariadb-upgrade and back up system tables after a version bump.30 Nov 2026
Security2
- Tip
mariadb-backup --backup --target-dir=/backup/full --user=root --passwordmariadb-backup copies the database files of a running server, and prepare makes them usableTakes a fast physical backup of a live MariaDB server instead of a slow SQL dump.30 Nov 2026 - Tip
cat > ~/.my.cnf <<'EOF'A [client] section in ~/.my.cnf keeps the database password off your command lineStores the client login in a private file so commands and cron jobs need no -p.30 Nov 2026
Shell1
Git1
Nothing matches.