MARIADB(1) MariaDB Database System MARIADB(1) (NAME) mariadb - MariaDB ( mysql mariadb ) (SYNOPSIS) mariadb [options] db_name (DESCRIPTION) mariadb SQL ( GNU readline) . . ASCII . ( ) (tab-separated) . . --quick . mariadb . C API mariadb_use_result() / mysql_store_result() . mariadb . : shell> mariadb db_name : shell> mariadb --user=user_name --password=your_password db_name SQL ";" \g \G Enter . Control-C mariadb . Control-C mariadb . SQL (batch file) : shell> mariadb db_name < script.sql > output.tab mariadb [mariadb] [client] [client-server] [client-mariadb] . mariadb . o --help, -?, -I . o --abort-source-on-error 'source filename' . o --auto-rehash (rehashing). . rehashing --disable-auto-rehash --no-auto-rehash --skip-auto-rehash . mariadb rehash . Tab . mariadb . Tab . . o --auto-vertical-output . o --batch, -B tab . mariadb . (Batch mode) (escaping) . (raw) --raw . o --binary-mode . \C DELIMITER ( ) (piped) ) --batch mariadb ) 'source' ) . '\r\n' ASCII '\0' '\r\n' '\n' '\0' . o --character-sets-dir=path (character sets). o --column-names . o --column-type-info, -m . o --comments, -c . --skip-comments ( ) --comments ( ) . o --compress, -C . o --connect-timeout=seconds (timeout). ( 0 .) o --database=db_name, -D db_name . o --debug[=debug_options], -# [debug_options] (debug). debug_options 'd:t:o,file_name' . 'd:t:o,/tmp/mysql.trace' . o --debug-check . o --debug-info, -T CPU . o --default-auth=name . o --default-character-set=charset_name charset_name . utf8 mariadb MariaDB latin1 . . o --defaults-extra-file=filename filename . . o --defaults-file=filename filename . . o --defaults-group-suffix=suffix . o --delimiter=str . (";") . o --disable-named-commands . \* (";") . mariadb . . "MARIADB COMMANDS" . o --enable-cleartext-plugin . MySQL . o --execute=statement -e statement . --force . --batch . o --force -f SQL . --abort-source-on-error 0 . o --host=host_name -h host_name MariaDB . o --html -H HTML . o --ignore-spaces -i . '(' ( ) . . o --init-command=str SQL MariaDB. . o --line-numbers . --skip-line-numbers . o --local-infile[={0|1}] LOCAL LOAD DATA INFILE. LOCAL . --local-infile=0 --local-infile=1 LOCAL . LOCAL . o --max-allowed-packet=num . ( 16MB 1GB .) o --max-join-size=num join --safe-updates. ( 1,000,000 .) o --named-commands, -G mariadb. . quit \q . --skip-named-commands . "MARIADB COMMANDS" . . o --net-buffer-length=size TCP/IP . ( 16KB .) o --no-auto-rehash, -A --skip-auto-rehash . --auto-rehash . o --no-beep, -b . o --no-defaults . . o --one-database, -o . USE . binary log . o --pager[=command] . PAGER . less more cat [> filename] . Unix . --skip-pager . "MARIADB COMMANDS" . o --password[=password], -p[password] . (-p) (space) . password --password -p mariadb . . (option file) . o --pipe, -W named pipe . named-pipe . o --plugin-dir=dir_name (plugins) . o --port=port_num, -P port_num TCP/IP 0 my.cnf $MYSQL_TCP_PORT /etc/services (3306) . --protocol=tcp . o --print-defaults . . o --progress-reports ( ALTER TABLE) . ( --skip-progress-reports .) o --prompt=format_str (prompt) . "MARIADB COMMANDS" . o --protocol={TCP|SOCKET|PIPE|MEMORY} . . o --quick, -q (cache) . . mariadb . o --raw, -r "" . ( batch --batch --silent ) (escaped) . NUL \n \t \0 \\ . --raw . raw : % mariadb mariadb> SELECT CHAR(92); +----------+ | CHAR(92) | +----------+ | \ | +----------+ % mariadb -s mariadb> SELECT CHAR(92); CHAR(92) \\ % mariadb -s -r mariadb> SELECT CHAR(92); CHAR(92) \ o --reconnect . . --skip-reconnect --disable-reconnect . o --safe-updates, --i-am-a-dummy, -U UPDATE DELETE . --safe-updates . "MARIADB TIPS" . o --secure-auth ( 4.1.1) . . o --select-limit=limit SELECT --safe-updates. ( 1,000 .) o --server-arg=name name (embedded server). o --show-warnings . . o --sigint-ignore SIGINT ( Control-C) . o --silent, -s . . . . (raw) --raw . o --skip-auto-rehash . --disable-auto-rehash. o --skip-column-names, -N . o --skip-line-numbers, -L . . o --socket=path, -S path localhost (Unix socket) Windows (named pipe) . --protocol=socket Windows --protocol=pipe . o --ssl SSL ( ). --skip-ssl . o --ssl-ca=name CA PEM ( OpenSSL --ssl ). o --ssl-capath=name CA ( OpenSSL --ssl ). o --ssl-cert=name X509 PEM ( OpenSSL --ssl ). o --ssl-cipher=name (cipher) SSL ( OpenSSL --ssl ). o --ssl-key=name X509 PEM ( OpenSSL --ssl ). o --ssl-crl=name ( OpenSSL --ssl ). o --ssl-crlpath=name ( OpenSSL --ssl ). o --ssl-verify-server-cert.sp <> . . o --table, -t . (batch) . o --tee=file_name . . "MARIADB COMMANDS" tee . o --unbuffered, -n . o --user=user_name, -u user_name MariaDB . o --verbose, -v (verbose). . . ( -v -v -v .) o --version, -V . o --vertical, -E ( ). \G . o --wait, -w . o --xml, -X XML. --xml mariadb mariadb-dump --xml . mariadb-dump(1) . XML XML : shell> mariadb --xml -uroot -e "SHOW VARIABLES LIKE 'version%'" version 5.0.40-debug version_comment Source distribution version_compile_machine i686 version_compile_os suse-linux-gnu --var_name=value . o connect_timeout . ( 0 .) o max_allowed_packet . ( 16MB .) o max_join_size (join) --safe-updates. ( 1,000,000 .) o net_buffer_length TCP/IP . ( 16KB .) o select_limit SELECT --safe-updates. ( 1,000 .) mariadb . .mariadb_history . .mariadb_history .mariadb_history . MARIADB_HISTFILE . MARIADB_HISTFILE MYSQL_HISTFILE . .mariadb_history SQL . .mariadb_history : o MARIADB_HISTFILE /dev/null . . o .mariadb_history (symbolic link) /dev/null: shell> ln -s /dev/null $HOME/.mariadb_history . mariadb SQL . mariadb . help \h mariadb> : mariadb> help List of all MariaDB commands: Note that all text commands must be first on line and end with ';' ? (\?) Synonym for 'help'. clear (\c) Clear command. connect (\r) Reconnect to the server. Optional arguments are db and host. delimiter (\d) Set statement delimiter. edit (\e) Edit command with $EDITOR. ego (\G) Send command to mariadb server, display result vertically. exit (\q) Exit mariadb. Same as quit. go (\g) Send command to mariadb server. help (\h) Display this help. nopager (\n) Disable pager, print to stdout. notee (\t) Don't write into outfile. pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. print (\p) Print current command. prompt (\R) Change your mariadb prompt. quit (\q) Quit mariadb. rehash (\#) Rebuild completion hash. source (\.) Execute an SQL script file. Takes a file name as an argument. status (\s) Get status information from the server. system (\!) Execute a system shell command. tee (\T) Set outfile [to_outfile]. Append everything into given outfile. use (\u) Use another database. Takes database name as argument. charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. warnings (\W) Show warnings after every statement. nowarning (\w) Don't show warnings after every statement. For server side help, type 'help contents' . . . /* ... */ . o help [arg], \h [arg], \? [arg], ? [arg] mariadb . help mariadb . " MARIADB (MARIADB SERVER-SIDE HELP)" . o charset charset_name, \C charset_name (character set) SET NAMES . mariadb (auto-reconnect) ( ) . o clear, \c . . o connect [db_name host_name]], \r [db_name host_name]] . . . o delimiter str, \d str mariadb SQL . (";") . . (') (") . ("\") . MariaDB . . . mariadb ";" . ";" . (multiple-statement) (stored procedures and functions) (triggers) (events) . o edit, \e . mariadb EDITOR VISUAL . vi ..sp edit Unix . o ego, \G . o exit, \q mariadb. o go, \g . o nopager, \n . pager . nopager Unix . o notee, \t tee . tee . o nowarning, \w . o pager [command], \P [command] . --pager mariadb Unix less more . mariadb PAGER . . pager nopager . . stdout . Unix popen() Windows . Windows tee pager . o print, \p . o prompt [str], \R [str] mariadb . ..sp prompt mariadb mariadb> . o quit, \q mariadb. o rehash, \# . ( --auto-rehash .) o source file_name, \. file_name . Windows / \\ . o status, \s . --safe-updates status mariadb . o system command, \! command . system Unix . o tee [file_name], \T [file_name] --tee mariadb . . . mariadb . tee . tee . . tee notee . tee . o use db_name, \u db_name db_name . o warnings, \W ( ) . pager : o : mariadb> pager cat > /tmp/log.txt pager : mariadb> pager less -n -i -S o -S . . . -S less . -S less . less : shell> man less o -F -X less : mariadb> pager less -n -i -S -F -X o pager : mariadb> pager cat | tee /dr1/tmp/res.txt \ | tee /dr2/tmp/res2.txt | less -n -i -S /dr1 /dr2 (mount) less . tee pager . tee pager less less (append) . tee pager tee mariadb tee tee . tee tee pager . tee mariadb . . prompt mariadb> . . +----------------+-----------------------------------------+ | | | +----------------+-----------------------------------------+ |\c | | | | | | | | | | | | | | +----------------+-----------------------------------------+ |\D | | | | | +----------------+-----------------------------------------+ |\d | | | | | +----------------+-----------------------------------------+ |\h | | | | | +----------------+-----------------------------------------+ |\l | | | | ( | | | 5.1.12) | +----------------+-----------------------------------------+ |\m | | | | | +----------------+-----------------------------------------+ |\n | | | | | +----------------+-----------------------------------------+ |\O | | | | | | | (Jan Feb ...) | +----------------+-----------------------------------------+ |\o | | | | | +----------------+-----------------------------------------+ |\P | am/pm | +----------------+-----------------------------------------+ |\p | TCP/IP | | | | +----------------+-----------------------------------------+ |\R | | | | | | | (0-23) | +----------------+-----------------------------------------+ |\r | | | | | | | | | | (1-12) | +----------------+-----------------------------------------+ |\S | | +----------------+-----------------------------------------+ |\s | | | | | +----------------+-----------------------------------------+ |\t | | +----------------+-----------------------------------------+ |\U | | | | | | | | | | user_name@host_name | +----------------+-----------------------------------------+ |\u | | +----------------+-----------------------------------------+ |\v | | +----------------+-----------------------------------------+ |\w | | | | | | | (Mon Tue | | | ...) | +----------------+-----------------------------------------+ |\Y | | | | | +----------------+-----------------------------------------+ |\y | | | | | +----------------+-----------------------------------------+ |\_ | | +----------------+-----------------------------------------+ |\ | ( | | | | | | | | | ) | +----------------+-----------------------------------------+ |\' | | +----------------+-----------------------------------------+ |\" | | | | | +----------------+-----------------------------------------+ |\\ | | | | "\" | +----------------+-----------------------------------------+ |\x | x "x" | | | | | | .TE | | | | | | | | | | | | o | | | | | | . | | | | | | | | | MYSQL_PS1 | | | | | | . | | | : shell> | | | export MYSQL_PS1="(\u@\h) [\d]> "o | | | | | | . | | | | | | --prompt | | | | | | mariadb . | | | : shell> | | | mariadb --prompt="(\u@\h) [\d]> " | | | (user@host) [database]>o | | | | | | . | | | | | | prompt | | | [mariadb] | | | | | | MariaDB | | | /etc/my.cnf | | | .my.cnf | | | | | | | | | . | | | : [mariadb] | | | prompt=(\\u@\\h) [\\d]>\\_ | | | | | | | | | | | | . | | | | | | | | | prompt | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | | | | (escape sequences) | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | | | | . | | | \s | | | | | | | | | | | | (space) | | | . | | | | | | | | | | | | | | | | | | | | | | | | HH:MM:SS> | | | : | | | [mariadb] prompt="\\r:\\m:\\s> "o | | | | | | . | | | | | | | | | | | | | | | | | | prompt ( \R) | | | . | | | : mariadb> | | | prompt (\u@\h) [\d]>\_ PROMPT set to | | | '(\u@\h) [\d]>\_' (user@host) | | | [database]> (user@host) [database]> | | | prompt Returning to default PROMPT of | | | mariadb> mariadb> mariadb> help | | | search_string | | | | | | help | | | mariadb | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | | | | mysql | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | | | | : mariadb> help me Nothing | | | found Please try to run 'help contents' | | | for a list of all accessible topics | | | | | | | | | | | | help | | | contents | | | : mariadb> help contents | | | You asked for help about help category: | | | "Contents" For more information, type | | | 'help ', where is one of | | | the following categories: Account | | | Management Administration Data | | | Definition Data Manipulation Data | | | Types Functions Functions and | | | Modifiers for Use with GROUP BY | | | Geographic Features Language | | | Structure Plugins Storage Engines | | | Stored Routines Table Maintenance | | | Transactions Triggers | | | | | | | | | | | | mariadb | | | | | | | | | | | | : mariadb> help logs | | | Many help items for your request exist. | | | To make a more specific request, please | | | type 'help ', where is one | | | of the following topics: SHOW | | | SHOW BINARY LOGS SHOW ENGINE SHOW | | | LOGS | | | | | | | | | | | | | | | | | | | | | : mariadb> help show | | | binary logs Name: 'SHOW BINARY LOGS' | | | Description: Syntax: SHOW BINARY LOGS | | | SHOW MASTER LOGS Lists the binary log | | | files on the server. This statement is | | | used as part of the procedure described | | | in [purge-binary-logs], that shows how | | | to determine which logs can be purged. | | | mariadb> SHOW BINARY LOGS; | | | +---------------+-----------+ | | | | Log_name | File_size | | | | +---------------+-----------+ | | | | binlog.000015 | 724935 | | | | | binlog.000016 | 733481 | | | | +---------------+-----------+ . . . . . | | | . . . . mariadb | | | | | | | | | | | | | | | : shell> mariadb db_name | | | | | | | | | | | | SQL | | | | | | | | | mariadb | | | | | | | | | . | | | | | | text_file | | | | | | | | | | | | | | | . mariadb | | | | | | | | | | | | : | | | shell> mariadb db_name < text_file | | | USE db_name | | | | | | | | | | | | | | | | | | | | | | | | : shell> | | | mariadb < text_file | | | mariadb | | | | | | | | | | | | SQL | | | | | | source | | | \. | | | : mariadb> source file_name | | | mariadb> \. file_name | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | : SELECT | | | '' AS ' '; | | | | | | | | | | | | | | | . | | | | | | mariadb | | | | | | --verbose | | | | | | | | | | | | | | | | | | . | | | mariadb | | | | | | (BOM) | | | | | | | | | | | | . BOM | | | | | | mariadb | | | | | | | | | . | | | mariadb | | | | | | | | | --default-character-set=utf8 | | | . | | | " MARIADB (MARIADB TIPS)" | | | | | | | | | | | | | | | | | | mariadb | | | . | | | " | | | " | | | | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | \G | | | | | | (semicolon) | | | | | | . | | | | | | | | | | | | | | | | | | | | | | | | | | | : mariadb> SELECT | | | * FROM mails WHERE LENGTH(txt) < 300 | | | LIMIT 300,1\G | | | *************************** 1. row | | | *************************** msg_nro: | | | 3068 date: 2000-03-01 23:29:50 | | | time_zone: +0200 mail_from: Monty | | | reply: monty@no.spam.com mail_to: | | | "Thimble Smith" | | | sbj: UTF-8 txt: >>>>> "Thimble" | | | == Thimble Smith writes: Thimble> Hi. | | | I think this is a good idea. Is anyone | | | familiar Thimble> with UTF-8 or | | | Unicode? Otherwise, I'll put this on my | | | Thimble> TODO list and see what | | | happens. Yes, please do that. Regards, | | | Monty file: inbox-jani-1 | | | hash: 190402944 1 row in set (0.09 sec) | | | " | | | --safe-updates" . | | | | | | | | | | | | | | | --safe-updates ( | | | --i-am-a-dummy | | | | | | ). | | | | | | | | | | | | DELETE FROM | | | tbl_name | | | | | | WHERE | | | | | | . | | | | | | | | | | | | . | | | --safe-updates | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | . | | | | | | --safe-updates | | | mariadb | | | | | | MariaDB | | | | | | : SET | | | sql_safe_updates=1, | | | sql_select_limit=1000, | | | sql_max_join_size=1000000; | | | SET | | | o | | | | | | | | | UPDATE DELETE | | | | | | | | | WHERE | | | | | | LIMIT ( | | | ) | | | . | | | : UPDATE tbl_name SET | | | not_key_column=val WHERE | | | key_column=val; UPDATE tbl_name SET | | | not_key_column=val LIMIT 1;o | | | | | | SELECT | | | 1,000 | | | | | | | | | | | | LIMIT .o | | | | | | | | | SELECT | | | | | | | | | 1,000,000 | | | | | | | | | . | | | | | | | | | 1,000 | | | 1,000,000 | | | | | | | | | | | | --select-limit --max-join-size | | | | | | | | | : | | | shell> mariadb --safe-updates | | | --select-limit=500 | | | --max-join-size=10000 | | | mariadb | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | mariadb | | | | | | | | | | | | | | | | | | | | | | | | | | | : | | | | | | | | | autocommit | | | | | | | | | | | | . | | | | | | | | | (roll back) | | | . | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | : mariadb> SET @a=1; | | | Query OK, 0 rows affected (0.05 sec) | | | mariadb> INSERT INTO t VALUES(@a); | | | ERROR 2006: MariaDB server has gone | | | away No connection. Trying to | | | reconnect... Connection id: 1 | | | Current database: test Query OK, 1 row | | | affected (1.30 sec) mariadb> SELECT * | | | FROM t; +------+ | a | +------+ | | | | NULL | +------+ 1 row in set (0.05 sec) | | | @a | | | | | | | | | | | | | | | | | | . | | | | | | | | | mariadb | | | | | | | | | mariadb | | | | | | --skip-reconnect | | | . | | | " | | | (COPYRIGHT)" | | | 2007-2008 | | | MySQL AB 2008-2010 Sun Microsystems, | | | Inc. 2010-2025 MariaDB Foundation | | | | | | | | | | | | | | | | | | << | | | >> (GNU | | | General Public License) | | | | | | | | | | | | | | | | | | | | | | | | / | | | . | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | << | | | >> | | | . | | | | | | | | | | | | << | | | >> | | | | | | | | | Free | | | Software Foundation, Inc., 51 Franklin | | | Street, Fifth Floor, Boston, MA | | | 02110-1335 USA | | | | | | http://www.gnu.org/licenses | | | . | | | " (NOTES)" " 1." 4 | | | Bug#25946 4 | | | http://bugs.mysql.com/bug.php?id=25946 | | | " | | | (SEE ALSO)" | | | | | | | | | MariaDB | | | | | | | | | https://mariadb.com/docs | | | | | | . | | | " (AUTHORS)" | | | MariaDB Foundation | | | (http://www.mariadb.org). | +----------------+-----------------------------------------+ MariaDB 11.8 5 March 2025 MARIADB(1)