MARIADB-ADMIN(1)

πŸ’– MARIADB-ADMIN(1) β€” bestie, let's admin some databases πŸ’–

okay so real quick, the manual name is MARIADB-ADMIN(1) and this is literally the client for administering a MariaDB server. also cute detail: mariadb-admin is now a symlink to mariadb-admin β€” yes, the manual says that, and no, we're not questioning it, we're just vibing. ✨


✨ NAME ✨

mariadb-admin β€” a client for administering a MariaDB server (mariadb-admin is now a symlink to mariadb-admin). 🫢


🌸 SYNOPSIS 🌸

mariadb-admin [options] command [command-arg] [command [command-arg]]
                                                                          ...

πŸ‘‘ DESCRIPTION πŸ‘‘

so mariadb-admin is a client for performing administrative operations. you can use it to check the server's configuration and current status, to create and drop databases, and like, so much more. it's giving "one tool, all the chores." πŸ’…

you invoke it like this, bestie:

shell> mariadb-admin [options] command [command-arg] [command [command-arg]] ...

mariadb-admin supports the commands below. some of them take an argument right after the command name β€” keep that in mind. πŸ‘€

πŸŽ€ the commands πŸŽ€

  • create db_name β€” make a brand new database called db_name. new database, who dis.
  • debug β€” tell the server to write debug information to the error log. this also includes info about the Event Scheduler. the scheduler said "not me getting logged."
  • drop db_name β€” delete the database named db_name and all its tables. it's gone gone. 😭
  • extended-status β€” display the server status variables and their values.
  • flush-all-statistics β€” flush all statistics tables.
  • flush-all-status β€” flush all status and statistics.
  • flush-binary-log β€” flush the binary log.
  • flush-client-statistics β€” flush client statistics.
  • flush-engine-log β€” flush engine log.
  • flush-error-log β€” flush error log.
  • flush-general-log β€” flush general query log.
  • flush-hosts β€” flush all information in the host cache.
  • flush-index-statistics β€” flush index statistics.
  • flush-logs β€” flush all logs.
  • flush-privileges β€” reload the grant tables (same as reload).
  • flush-relay-log β€” flush relay log.
  • flush-slow-log β€” flush slow query log.
  • flush-ssl β€” flush SSL certificates.
  • flush-status β€” clear status variables.
  • flush-table-statistics β€” flush table statistics.
  • flush-tables β€” flush all tables.
  • flush-threads β€” flush the thread cache.
  • flush-user-resources β€” flush user resources.
  • kill id,id,... β€” kill server threads. if you're passing multiple thread ID values, there must be no spaces in the list. none. zero. nope.
  • old-password new-password β€” this is like the password command but stores the password using the old (pre MySQL 4.1) password-hashing format. vintage-core, lowkey.
  • password new-password β€” set a new password. this changes the password to new-password for the account you use with mariadb-admin to connect to the server. so the next time you invoke mariadb-admin (or literally any other client program) using that same account, you'll need to specify the new password. ✨

if the new-password value contains spaces or other characters that are special to your command interpreter, you need to wrap it in quotes. on Windows, be sure to use double quotes rather than single quotes β€” single quotes are not stripped from the password, they're interpreted as part of the password. ask us how we know. πŸ™ˆ for example:

shell> mariadb-admin password "my new password"
Caution ⚠️ do not use this command if the server was started with the --skip-grant-tables option. no password change will be applied. this is true even if you precede the password command with flush-privileges on the same command line to re-enable the grant tables, because the flush operation occurs after you connect. however, you can use mariadb-admin flush-privileges to re-enable the grant table and then use a separate mariadb-admin password command to change the password. two steps, one slay.
  • ping β€” check whether the server is alive. the return status from mariadb-admin is 0 if the server is running, 1 if it is not. and it's 0 even in case of an error such as Access denied, because that means the server is running but refused the connection, which is different from the server not running. she's alive, she's just being difficult. πŸ’€
  • processlist β€” show a list of active server threads. this is like the output of the SHOW PROCESSLIST statement. if the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST.
  • reload β€” reload the grant tables.
  • refresh β€” flush all tables and close and open log files.
  • shutdown β€” stop the server. bye bestie. 😭
  • start-all-slaves β€” start all slaves.
  • start-slave β€” start replication on a slave server.
  • status β€” display a short server status message.
  • stop-all-slaves β€” stop all slaves.
  • stop-slave β€” stop replication on a slave server.
  • variables β€” display the server system variables and their values.
  • version β€” display version information from the server.

all commands can be shortened to any unique prefix. periodt. for example:

shell> mariadb-admin proc stat
+----+-------+-----------+----+---------+------+-------+------------------+
| Id | User  | Host      | db | Command | Time | State | Info             |
+----+-------+-----------+----+---------+------+-------+------------------+
| 51 | monty | localhost |    | Query   | 0    |       | show processlist |
+----+-------+-----------+----+---------+------+-------+------------------+
Uptime: 1473624  Threads: 1  Questions: 39487
Slow queries: 0  Opens: 541  Flush tables: 1
Open tables: 19  Queries per second avg: 0.0268

πŸ¦‹ what the status command is actually telling you πŸ¦‹

the mariadb-admin status command result displays these values, and yes we're going through all of them:

  • Uptime β€” the number of seconds the MariaDB server has been running.
  • Threads β€” the number of active threads (clients).
  • Questions β€” the number of questions (queries) from clients since the server was started.
  • Slow queries β€” the number of queries that have taken more than log_slow_query_time seconds.
  • Opens β€” the number of tables the server has opened.
  • Flush tables β€” the number of flush-*, refresh, and reload commands the server has executed.
  • Open tables β€” the number of tables that currently are open.
  • Memory in use β€” the amount of memory allocated directly by mariadbd. this value is displayed only when MariaDB has been compiled with --with-debug=full.
  • Maximum memory used β€” the maximum amount of memory allocated directly by mariadbd. this value is displayed only when MariaDB has been compiled with --with-debug=full.

if you execute mariadb-admin shutdown when connecting to a local server using a Unix socket file, mariadb-admin waits until the server's process ID file has been removed, to make sure the server has stopped properly. so patient. so responsible. πŸ‘‘

πŸ’… the options πŸ’…

mariadb-admin supports the following options, which can be specified on the command line or in the [mariadb-admin] and [client] option file groups.

  • --help, -? β€” display help and exit.
  • --character-sets-dir=path β€” the directory where character sets are installed.
  • --compress, -C β€” compress all information sent between the client and the server, if both support compression.
  • --connect-timeout=timeout β€” equivalent to --connect_timeout, see the end of this section.
  • --count=N, -c N β€” the number of iterations to make for repeated command execution, if the --sleep option is given.
  • --debug[=debug_options], -# [debug_options] β€” write a debugging log. a typical debug_options string is 'd:t:o,file_name'. the default is 'd:t:o,/tmp/mariadb-admin.trace'.
  • --debug-check β€” check memory and open file usage at exit.. (yes, the double period is in the original, we're keeping it, it's iconic πŸŽ€)
  • --debug-info β€” print debugging information and memory and CPU usage statistics when the program exits.
  • --default-auth β€” default authentication client-side plugin to use.
  • --default-character-set=charset_name β€” use charset_name as the default character set.
  • --defaults-extra-file=filename β€” set filename as the file to read default options from, after the global defaults files has been read. must be given as first option.
  • --defaults-file=filename β€” set filename as the file to read default options from, override global defaults files. must be given as first option.
  • --force, -f β€” do not ask for confirmation for the drop db_name command. with multiple commands, continue even if an error occurs.
  • --host=host_name, -h host_name β€” connect to the MariaDB server on the given host.
  • --local, -l β€” suppress the SQL command(s) from being written to the binary log by using FLUSH LOCAL or enabling sql_log_bin=0 for the session.
  • --no-beep, -b β€” suppress the warning beep that is emitted by default for errors such as a failure to connect to the server. beep begone. πŸ”•
  • --no-defaults β€” do not read default options from any option file. this must be given as the first argument.
  • --password[=password], -p[password] β€” the password to use when connecting to the server. if you use the short option form (-p), you cannot have a space between the option and the password. if you omit the password value following the --password or -p option on the command line, mariadb-admin prompts for one.
specifying a password on the command line should be considered insecure. πŸ”₯
  • --pipe, -W β€” on Windows, connect to the server via a named pipe. this option applies only if the server supports named-pipe connections.
  • --port=port_num, -P port_num β€” the TCP/IP port number to use for the connection, or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). forces --protocol=tcp when specified on the command line without other connection properties.
  • --print-defaults β€” print the program argument list and exit. this must be given as the first argument.
  • --protocol={TCP|SOCKET|PIPE|MEMORY} β€” the connection protocol to use for connecting to the server. it's useful when the other connection parameters normally would cause a protocol to be used other than the one you want.
  • --relative, -r β€” show the difference between the current and previous values when used with the --sleep option. currently, this option works only with the extended-status command.
  • --shutdown-timeouttimeout
  • --shutdown_timeout β€” bestie this is literally the same thing as that option up there, pls see the end of this section πŸ’«
  • --silent, -s β€” if we can't even get a connection to the server, just dip. silently. no drama, no message, nothing 🌸
  • --sleep=delay, -i delay β€” runs the commands over and over, catching a lil nap for delay seconds in between each round 😴 the --count option is what decides how many rounds you do. and if you never gave --count? then mariadb-admin just keeps going forever and ever until you interrupt it. no cap.
  • --socket=path, -S path β€” when you're connecting to localhost, this is the Unix socket file to use 🫢 (or, on Windows, the name of the named pipe). Fun fact: if you put this on the command line all by itself with no other connection properties, it forces --protocol=socket; and on Windows it forces --protocol=pipe. iconic behavior tbh.
  • --ssl β€” turn SSL on for the connection (it auto-enables itself when other flags are around too ✨). wanna turn it off? --skip-ssl.
  • --ssl-ca=name β€” the CA file, in PEM format (go check the OpenSSL docs; this one implies --ssl).
  • --ssl-capath=name β€” the CA directory (OpenSSL docs, bestie; implies --ssl).
  • --ssl-cert=name β€” the X509 cert, PEM format (OpenSSL docs; implies --ssl).
  • --ssl-cipher=name β€” which SSL cipher to use (OpenSSL docs; implies --ssl).
  • --ssl-key=name β€” the X509 key, PEM format (OpenSSL docs; implies --ssl).
  • --ssl-crl=name β€” certificate revocation list (OpenSSL docs; implies --ssl).
  • --ssl-crlpath=name β€” certificate revocation list path (OpenSSL docs; implies --ssl).
  • --ssl-verify-server-cert β€” checks the server's "Common Name" in its cert against the hostname you used when connecting πŸ‘‘ and heads up: this one is disabled by default.
  • --tls-version=name, β€” takes a comma-separated list of TLS protocol versions. a TLS protocol version only gets enabled if it's in this list β€” every other TLS protocol version is simply not permitted, periodt 🚫
  • --user=user_name, -u user_name β€” the MariaDB user name to use when connecting to the server πŸ’œ
  • --verbose, -v β€” verbose mode, bestie. it prints more info about what the program is actually doing πŸ‘€
  • --version, -V β€” shows the version info and exits. bye πŸ’…
  • --vertical, -E β€” prints the output vertically. it's giving --relative, but vertical 🌈
  • --wait[=count], -w[count] β€” if the connection can't be established, wait and retry instead of just aborting 🫢 and if you hand it a count value, that's how many times it retries. the default is one time.
  • --wait-for-all-slaves β€” waits for the last binlog event to be sent to all the connected slaves before shutting down. this option is off by default ⭐

🧚 the vars you can also set (yes really)

You can also set the following variables by using --var_name=value

  • connect_timeout β€” the max number of seconds before the connection times out. the default value is 43200 (that's 12 hours, girl 😭).
  • shutdown_timeout β€” the max number of seconds to wait for the server to shut down. the default value is 3600 (that's 1 hour ⏰).

Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation

This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.


πŸ‘€ SEE ALSO

For more information, please refer to the MariaDB Documentation, available online at https://mariadb.com/docs/


πŸŽ€ AUTHOR

MariaDB Foundation (http://www.mariadb.org/).


okay that's the whole page bestie, you ate that πŸ’… this was MariaDB 11.8, dated 5 March 2025 β€” go be the main character of your own database now πŸ¦‹βœ¨

πŸ“¦ where this page comes from