All pages
Powered by GitBook
1 of 18

Administrative Tools

dbdeployer

dbdeployer is a tool for installing multiple versions of MariaDB and/or MySQL in isolation from each other. It is primarily used for easily testing different server versions. It is written in Go, and is a replacement for MySQL Sandbox.

Visit www.dbdeployer.com for details on how to install and use it.

This page is licensed: CC BY-SA / Gnu FDL

innochecksum

innochecksum is a tool for printing checksums for InnoDB files.

Usage

innochecksum [options] file_name

Description

It reads an InnoDB tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies. Because checksum mismatches will cause InnoDB to deliberately shut down a running server, it can be preferable to use innochecksum rather than waiting for a server in production usage to encounter the damaged pages.

Multiple filenames can be specified by a wildcard on non-Windows systems only.

innochecksum works with compressed pages, and also includes options to analyze leaf pages to estimate how fragmented an index is and how much benefit can be gained from defragmentation.

innochecksum cannot be used on tablespace files that the server already has open. For such files, you should use CHECK TABLE to check tables within the tablespace. If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use mariadb-dump to make a backup of the tables within the tablespace.

Options

innochecksum supports the following options. For options that refer to page numbers, the numbers are zero-based.

Option
Description

-a, --allow-mismatches=#

Maximum checksum mismatch allowed before innochecksum terminates. Defaults to 0, which terminates on the first mismatch.

-c, --count

Print a count of the number of pages in the file.

-e num, --end-page=#

End at this page number (0-based).

-?, --help

Displays help and exits.

-I, --info

Synonym for --help.

-f, --leaf

Examine leaf index pages.

-l fn, --log=fn

Log output to the specified filename fn.

-m num, --merge=#

Leaf page count if merge given number of consecutive pages.

-n, --no-check

Ignore the checksum verification. Until MariaDB 10.6, must be used with the --write option.

-p num, --page=#

Check only this page number (0-based).

-D, --page-type-dump=name

Dump the page type info for each page in a tablespace.

-S, --page-type-summary

Display a count of each page type in a tablespace

-i, --per-page-details

Print out per-page detail information.

-u, --skip-corrupt

Skip corrupt pages.

-r, --skip-freed-pages

innochecksum misinterprets freed pages as active, leading to confusion that too many valid pages exist. To avoid this, this option was introduced to avoid freed pages while dumping or printing the summary of the tablespace. From MariaDB 10.6.21, MariaDB 10.11.11, MariaDB 11.4.5, MariaDB 11.7.2.

-s num, --start-page=#

Start at this page number (0-based).

-C, --strict-check=name

Specify the strict checksum algorithm. One of: crc32, innodb, none. If not specified, validates against innodb, crc32 and none. full_crc32 is not supported. See also innodb_checksum_algorithm. Removed in MariaDB 10.6.0

-v, --verbose

Verbose mode; print a progress indicator every five seconds.

-V, --version

Displays version information and exits.

-w, --write=name

Rewrite the checksum algorithm. One of crc32, innodb, none. An exclusive lock is obtained during use. Use in conjunction with the -no-check option to rewrite an invalid checksum. Removed in MariaDB 10.6.0

Examples

Rewriting a crc32 checksum to replace an invalid checksum:

innochecksum --no-check --write crc32 tablename.ibd

A count of each page type:

innochecksum --page-type-summary data/mysql/gtid_slave_pos.ibd

File::data/mysql/gtid_slave_pos.ibd
================PAGE TYPE SUMMARY==============
#PAGE_COUNT	PAGE_TYPE
===============================================
       1	Index page
       0	Undo log page
       1	Inode page
       0	Insert buffer free list page
       2	Freshly allocated page
       1	Insert buffer bitmap
       0	System page
       0	Transaction system page
       1	File Space Header
       0	Extent descriptor page
       0	BLOB page
       0	Compressed BLOB page
       0	Page compressed page
       0	Page compressed encrypted page
       0	Other type of page

===============================================
Additional information:
Undo page type: 0 insert, 0 update, 0 other
Undo page state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
index_id	#pages		#leaf_pages	#recs_per_page	#bytes_per_page
24		1		1		0		0

index_id	page_data_bytes_histgram(empty,...,oversized)
24		1	0	0	0	0	0	0	0	0	0	0	0

This page is licensed: CC BY-SA / Gnu FDL

mariadb-access

mariadb-access is a tool for checking access privileges, developed by Yves Carlier.

Prior to MariaDB 10.5, the client used to be called mysqlaccess, and can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

It checks the access privileges for a host name, user name, and database combination. Note that mariadb-access checks access using only the user, db, and host tables. It does not check table, column, or routine privileges specified in the tables_priv, columns_priv, or procs_priv tables.

Usage

mariadb-access [host [user [db]]] OPTIONS

If your MariaDB distribution is installed in some non-standard location, you must change the location where mariadb-access expects to find the mariadb client. Edit the mariadb-access script at approximately line 18. Search for a line that looks like this: < $MYSQL = ´/usr/local/bin/mariadb;

path to mariadb executable

<> Change the path to reflect the location where mariadb actually is stored on your system. If you do not do this, a Broken pipe error will occur when you run mariadb-access.

Options

Option
Description

-?, --help

Displayhelp and exit.

-v, --version

Display version.

-u username, --user=username

Username for logging in to the db.

-p[password], --password[=password]

Password to use for user. If ommitted, mariadb-access prompts for one.

-h hostname, --host=hostname

Name or IP of the host.

-d dbname, --db=dbname

Name of the database.

-U username, --superuser=username

Connect as superuser.

-P password, --spassword=password

Password for superuser.

-H server, --rhost=server

Remote server to connect to.

--old_server

Connect to a very old MySQL servers (before version 3.21) that does not know how to handle full WHERE clauses.

-b, --brief

Single-line tabular report.

-t, --table

Report in table-format.

--relnotes

Print release-notes.

--plan

Print suggestions/ideas for future releases.

--howto

Some examples of how to run `mariadb-access'.

--debug=N

Enter debug level N (0..3).

--copy

Reload temporary grant-tables from original ones.

--preview

Show differences in privileges after making changes in (temporary) grant-tables.

--commit

Copy grant-rules from temporary tables to grant-tables (the grant tables must be flushed after, for example with mariadb-admin reload).

--rollback

Undo the last changes to the grant-tables.

Note

At least the user (-u) and the database (-d) must be given, even with wildcards. If no host is provided, `localhost' is assumed. Wildcards (,?,%,_) are allowed for host, user and db, but be sure to escape them from your shell!! (ie type * or '')

This page is licensed: CC BY-SA / Gnu FDL

mariadb-admin

mariadb-admin

mariadb-admin is an administration program for the mariadbd daemon. It can be used to:

  • Monitor what the MariaDB clients are doing (processlist)

  • Get usage statistics and variables from the MariaDB server

  • Create/drop databases

  • Flush (reset) logs, statistics and tables

  • Kill running queries.

  • Stop the server (shutdown)

  • Start/stop replicas

  • Check if the server is alive (ping)

Prior to MariaDB 10.5, the client was called mysqladmin. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

Using mariadb-admin

The command to use mariadb-admin and the general syntax is:

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

Options

mariadb-admin supports the following options:

Option
Description

--character-sets-dir=name

Directory where the character set files are located.

-C, --compress

Compress all information sent between the client and the server if both support compression.

--connect_timeout=val

Maximum time in seconds before connection timeout. The default value is 43200 (12 hours).

-c val, --count=val

Number of iterations to make. This works with -i (--sleep) only.

--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/mysqladmin.trace.

--debug-check

Check memory and open file usage at exit.

--debug-info

Print debugging information and memory and CPU usage statistics when the program exits.

--default-auth=plugin

Default authentication client-side plugin to use.

--default-character-set=name

Set the default character set.

-f, --force

Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.

-?, --help

Display this help and exit.

-h name, --host=name

Hostname to connect to.

-l, --local

Suppress the SQL command(s) from being written to the binary log by enabling sql_log_bin=0 for the session, or, from MariaDB 10.2.7 and MariaDB 10.1.24, for flush commands only, using FLUSH LOCAL rather than SET sql_log_bin=0, so the privilege requirement is RELOAD rather than SUPER.

-b, --no-beep

Turn off beep on error.

-p[password], --password[=password]

Password to use when connecting to server. If password is not given it's asked from the terminal.

--pipe, -W

On Windows, connect to the server via a named pipe. This option applies only if the server supports named-pipe connections.

-P portnum, --port=portnum

Port number to use for connection, or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306).

--protocol=name

The protocol to use for connection (tcp, socket, pipe, memory).

-r, --relative

Show difference between current and previous values when used with -i. Currently only works with extended-status.

-O value, --set-variable=vaue

Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.

--shutdown_timeout=val

Maximum number of seconds to wait for server shutdown. The default value is 3600 (1 hour).

-s, --silent

Silently exit if one can't connect to server.

-i delay, --sleep=delay

Execute commands repeatedly, sleeping for delay seconds in between. The --count option determines the number of iterations. If --count is not given, mariadb-admin executes commands indefinitely until interrupted.

-S name, --socket=name

For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.

--ssl

Enables TLS. TLS is also enabled even without setting this option when certain other TLS options are set. The --ssl option will not enable verifying the server certificate by default. In order to verify the server certificate, the user must specify the --ssl-verify-server-cert option.

--ssl-ca=name

Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for TLS. This option requires that you use the absolute path, not a relative path. See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option implies the --ssl option.

--ssl-capath=name

Defines a path to a directory that contains one or more PEM files that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for TLS. This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the openssl rehash command. See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option is only supported if the client was built with OpenSSL or yaSSL. If the client was built with GnuTLS or Schannel, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms. This option implies the --ssl option.

--ssl-cert=name

Defines a path to the X509 certificate file to use for TLS. This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.

--ssl-cipher=name

List of permitted ciphers or cipher suites to use for TLS. This option implies the --ssl option.

--ssl-crl=name

Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for TLS. This option requires that you use the absolute path, not a relative path. See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information. This option is only supported if the client was built with OpenSSL or Schannel. If the client was built with yaSSL or GnuTLS, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms.

--ssl-crlpath=name

Defines a path to a directory that contains one or more PEM files that should each contain one revoked X509 certificate to use for TLS. This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the openssl rehash command. See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information. This option is only supported if the client was built with OpenSSL. If the client was built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms.

--ssl-key=name

Defines a path to a private key file to use for TLS. This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.

--ssl-verify-server-cert

Enables server certificate verification. This option is disabled by default.

--tls-version=name

This option accepts a comma-separated list of TLS protocol versions. A TLS protocol version will only be enabled if it is present in this list. All other TLS protocol versions will not be permitted. See Secure Connections Overview: TLS Protocol Versions for more information.

-u, --user=name

User for login if not current user.

-v, --verbose

Write more information.

-V, --version

Output version information and exit.

-E, --vertical

Print output vertically. Is similar to '--relative', but prints output vertically.

-w[count], --wait[=count]

If the connection cannot be established, wait and retry instead of aborting. If a count value is given, it indicates the number of times to retry. The default is one time.

--wait-for-all-slaves

Wait for the last binlog event to be sent to all connected replicas before shutting down. This option is off by default.

Option Files

In addition to reading options from the command-line, mariadb-admin can also read options from option files. If an unknown option is provided to mariadb-admin in an option file, then it is ignored.

The following options relate to how MariaDB command-line tools handles option files. They must be given as the first argument on the command-line:

Option
Description

--print-defaults

Print the program argument list and exit.

--no-defaults

Don't read default options from any option file.

--defaults-file=#

Only read default options from the given file #.

--defaults-extra-file=#

Read this file after the global files are read.

--defaults-group-suffix=#

In addition to the default option groups, also read option groups with this suffix.

mariadb-admin is linked with MariaDB Connector/C. However, MariaDB Connector/C does not yet handle the parsing of option files for this client. That is still performed by the server option file parsing code. See MDEV-19035 for more information.

Option Groups

mariadb-admin reads options from the following option groups from option files:

Group
Description

[mysqladmin]

Options read by mysqladmin, which includes both MariaDB Server and MySQL Server.

[mariadb-admin]

Options read by mariadb-admin. Available starting with MariaDB 10.4.6.

[client]

Options read by all MariaDB and MySQL client programs, which includes both MariaDB and MySQL clients. For example, mysqldump.

[client-server]

Options read by all MariaDB client programs and the MariaDB Server. This is useful for options like socket and port, which is common between the server and the clients.

[client-mariadb]

Options read by all MariaDB client programs.

mariadb-admin Variables

Variables can be set with --variable-name=value.

Variables and boolean options
Value

count

0

debug-check

FALSE

debug-info

FALSE

force

FALSE

compress

FALSE

character-sets-dir

(No default value)

default-character-set

(No default value)

host

(No default value)

no-beep

FALSE

port

3306

relative

FALSE

socket

/var/run/mariadbd/mariadbd.sock

sleep

0

ssl

FALSE

ssl-ca

(No default value)

ssl-capath

(No default value)

ssl-cert

(No default value)

ssl-cipher

(No default value)

ssl-key

(No default value)

ssl-verify-server-cert

FALSE

user

(No default value)

verbose

FALSE

vertical

FALSE

connect_timeout

43200

shutdown_timeout

3600

mariadb-admin Commands

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

Command is one or more of the following. Commands may be shortened to a unique prefix.

Command
Description

create databasename

Create a new database.

debug

Instruct server to write debug information to log.

drop databasename

Delete a database and all its tables.

extended-status

Return all status variables and their values.

flush-all-statistics

Flush all statistics tables

flush-all-status

Flush status and statistics.

flush-binary-log

Flush 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 cached hosts.

flush-index-statistics

Flush index statistics.

flush-logs

Flush all logs.

flush-privileges

Reload grant tables (same as reload).

flush-relay-log

Flush relay log.

flush-slow-log

Flush slow query log.

flush-ssl

Flush SSL certificates. Added in MariaDB 10.6.0.

flush-status

Clear status variables.

flush-table-statistics

Clear table statistics.

flush-tables

Flush all tables.

flush-threads

Flush the thread cache.

flush-user-resources

Flush user resources.

flush-user-statistics

Flush user statistics.

kill id,id,...

Kill mysql threads.

password new-password

Change old password to new-password. The new password can be passed on the commandline as the next argument (for example, mariadb-admin password "new_password", or can be omitted (as long as no other command follows), in which case the user will be prompted for a password. If the password contains special characters, it needs to be enclosed in quotation marks. In Windows, the quotes can only be double quotes, as single quotes are assumed to be part of the password. If the server was started with the --skip-grant-tables option, changing the password in this way will have no effect.

old-password new-password

Change old password to new-password using the old pre-MySQL 4.1 format.

ping

Check if mariadbd is alive. Return status is 0 if the server is running (even in the case of an error such as access denied), 1 if it is not.

processlist

Show list of active threads in server, equivalent to SHOW PROCESSLIST. With --verbose, equivalent to SHOW FULL PROCESSLIST.

reload

Reload grant tables.

refresh

Flush all tables and close and open log files.

shutdown

Take server down by executing the SHUTDOWN command on the server. If connected to a local server using a Unix socket file, mariadb-admin waits until the server's process ID file has been removed to ensure that the server has stopped properly. See also the --wait-for-all-slaves option.

status

Gives a short status message from the server.

start-all-slaves

Start all replicas.

start-slave

Start replication on a replica server.

stop-all-slaves

Stop all replicas.

stop-slave

Stop replication on a replica server.

variables

Prints variables available.

version

Returns version as well as status info from the server.

The shutdown Command and the --wait-for-all-slaves Option

The --wait-for-all-slaves option was first added in MariaDB 10.4.4. When a primary server is shutdown and it goes through the normal shutdown process, the primary kills client threads in random order. By default, the primary also considers its binary log dump threads to be regular client threads. As a consequence, the binary log dump threads can be killed while client threads still exist, and this means that data can be written on the primary during a normal shutdown that won't be replicated. This is true even if semi-synchronous replication is being used.

In MariaDB 10.4 and later, this problem can be solved by shutting down the server with the mariadb-admin utility and by providing the --wait-for-all-slaves option to the utility and by executing the shutdown command with the utility. For example:

mariadb-admin --wait-for-all-slaves shutdown

When the --wait-for-all-slaves option is provided, the server only kills its binary log dump threads after all client threads have been killed, and it only completes the shutdown after the last binary log has been sent to all connected replicas.

See Replication Threads: Binary Log Dump Threads and the Shutdown Process for more information.

Examples

Quick check of what the server is doing:

shell> mariadb-admin status
Uptime: 8023 Threads: 1 Questions: 14 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.1
shell> mariadb-admin processlist
+----+-------+-----------+----+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------+-----------+----+---------+------+-------+------------------+
....
+----+-------+-----------+----+---------+------+-------+------------------+

More extensive information of what is happening 'just now' changing (great for troubleshooting a slow server):

shell> mariadb-admin --relative --sleep=1 extended-status | grep -v " 0 "

Check the variables for a running server:

shell> mariadb-admin variables | grep datadir
| datadir | /my/data/ |

Using a shortened prefix for the version command:

shell> mariadb-admin ver
mariadb-admin from 11.1.0-preview-MariaDB, client 9.1 for linux-systemd (x86_64)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version		11.1.0-preview-MariaDB
Protocol version	10
Connection		localhost via TCP/IP
TCP port		11100
Uptime:			3 min 21 sec

Threads: 1  Questions: 1  Slow queries: 0  Opens: 17  Open tables: 10  Queries per second avg: 0.004

Other Ways To Stop mariadbd (Unix)

If you get the error:

mariadb-admin: shutdown failed; error: 'Access denied; you need (at least one of) the SHUTDOWN privilege(s) for this operation'

It means that you didn't use mariadb-admin with a user that has the SUPER or SHUTDOWN privilege.

If you don't know the user password, you can still take the mariadbd process down with a system kill command:

kill -SIGTERM pid-of-mariadbd-process

The above is identical to mariadb-admin shutdown.

On windows you should use:

NET STOP MySQL

You can use the SHUTDOWN command from any client.

See Also

  • SHUTDOWN command

  • mytop, a 'top' like program for MariaDB/MySQL that allows you to see what the server is doing. A mytop optimized for MariaDB is included in MariaDB 5.3

This page is licensed: CC BY-SA / Gnu FDL

mariadb-conv

MariaDB starting with 10.5.1

mariadb-conv is a character set conversion utility for MariaDB and was added in MariaDB 10.5.1.

Usage

mariadb-conv [OPTION...] [FILE...]

Options

mariadb-conv supports the following options:

Option
Description

-f, --from=name

Specifies the encoding of the input.

-t, --to=name

Specifies the encoding of the output.

-c, --continue

Silently ignore conversion errors.

--delimiter=name

Treat the specified characters as delimiters.

By default, mariadb-conv exits whenever it encounters any conversion problems, for example:

  • the input byte sequence is not valid in the source character set

  • the character cannot be converted to the target character set

The -c option makes mariadb-conv ignore such errors and use the question mark '?' to replace bytes in bad input sequences, or unconvertable characters.

The --delimiter=... option makes mariadb-conv treat the specified characters as delimiters rather than data to convert, so the input is treated as a combination of:

  • data chunks, which are converted according to the -f and -t options.

  • delimiters, which are not converted and are copied from the input to the output as is.

Examples

Converts the file file.latin1.txt from latin1 to utf8.

mariadb-conv -f latin1 -t utf8 file.latin1.txt

Convert the file file.latin1.txt from latin1 to utf8, reading the input data from stdin.

mariadb-conv -f latin1 -t utf8 < file.latin1.txt

Using mariadb-conv in a pipe:

echo test | ./mariadb-conv -f utf8 -t ucs2 >file.ucs2.txt

As a side effect, mariadb-conv can be used to list MariaDB data directories in a human readable form. Suppose you create the following tables:

SET NAMES utf8;
CREATE OR REPLACE TABLE t1 (a INT);
CREATE OR REPLACE TABLE ß (a INT);
CREATE OR REPLACE TABLE абв (a INT);
CREATE OR REPLACE TABLE 桌子 (a INT);

The above makes the server create the following files in the MariaDB data directory:

@1j.frm
@1j.ibd
@684c@5b50.frm
@684c@5b50.ibd
@g0@h0@i0.frm
@g0@h0@i0.ibd
t1.frm
t1.ibd

It's not precisely clear which file stores which table, because MariaDB uses a special table-name-to-file-name encoding.

This command on Linux (assuming an utf-8 console) can print the table list in a readable way::

ls | mariadb-conv -f filename -t utf8 --delimiter=".\n"

ß.frm
ß.ibd
桌子.frm
桌子.ibd
абв.frm
абв.ibd
t1.frm
t1.ibd

Note, the --delimiter=".\n" option is needed to make mariadb-conv treat the dot character (delimiting the encoded table name from the file extension) and the new line character (delimiting separate lines) as delimiters rather than as the data to convert (otherwise the conversion would fail).

Windows users can use the following command to list the data directory in the ANSI text console:

dir /b | mariadb-conv -c -f filename -t cp850 --delimiter=".\r\n"

Note:

  • The -t options assume a Western machine.

  • The -c option is needed to ignore conversion errors for Cyrillic and CJK characters.

  • --delimiter= additionally needs the carriage return character

This page is licensed: CC BY-SA / Gnu FDL

mariadb-setpermission

Syntax

mariadb-setpermission [options]

Description

mariadb-setpermission is a Perl script that was originally written and contributed by Luuk de Boer. It requires the DBI and DBD::mysql Perl modules to be installed.mariadb-setpermission can help you add users or databases or change passwords in MariaDB.

Prior to MariaDB 10.5, the client was called mysql_setpermission. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

It interactively sets permissions in the MariaDB grant tables, but does not check permissions which have already been set in MariaDB. So if you can't connect to MariaDB using the permission you just added, take a look at the permissions which have already been set in MariaDB.

The account used when you connect determines which permissions you have when attempting to modify existing permissions in the grant tables.

mariadb-setpermission also reads options from the [client] and [perl] groups in the .my.cnf file in your home directory, if the file exists.

The following options are available:

Options

--help

Display a help message and exit.

--host=host_name

Connect to the MariaDB server on the given host.

--password=password

The password to use when connecting to the server. Note that the password value is not optional for this option, unlike for other MariaDB programs Specifying a password on the command line should be considered insecure. You can use an option file to avoid giving the password on the command line.

--port=port_num

The TCP/IP port number to use for the connection.

--socket=path

For connections to localhost, the Unix socket file to use.

--user=user_name

The MariaDB user name to use when connecting to the server.

Example

./mariadb-setpermission --user=msandbox --password=msandbox --host=127.0.0.1 --port=11200
######################################################################
## Welcome to the permission setter 1.4 for MariaDB.
## made by Luuk de Boer
######################################################################
What would you like to do:
  1. Set password for an existing user.
  2. Create a database + user privilege for that database
     and host combination (user can only do SELECT)
  3. Create/append user privilege for an existing database
     and host combination (user can only do SELECT)
  4. Create/append broader user privileges for an existing
     database and host combination
     (user can do SELECT,INSERT,UPDATE,DELETE)
  5. Create/append quite extended user privileges for an
     existing database and host combination (user can do
     SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
     LOCK TABLES,CREATE TEMPORARY TABLES)
  6. Create/append full privileges for an existing database
     and host combination (user has FULL privilege)
  7. Remove all privileges for an existing database and
     host combination.
     (user will have all permission fields set to N)
  0. exit this program

This page is licensed: CC BY-SA / Gnu FDL

mariadb-show

mariadb-show

Shows the structure of a MariaDB database (databases, tables, columns and indexes).

Prior to MariaDB 10.5, the client was called mysqlshow. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

You can also use SHOW DATABASES, SHOW TABLES, SHOW COLUMNS, SHOW INDEX and SHOW TABLE STATUS, as well as the Information Schema tables (TABLES, COLUMNS, STATISTICS), to get similar functionality.

Using mariadb-show

mariadb-show [OPTIONS] [database [table [column]]]

The output displays only the names of those databases, tables, or columns for which you have some privileges.

If no database is given then all matching databases are shown. If no table is given, then all matching tables in database are shown. If no column is given, then all matching columns and column types in table are shown.

If the last argument contains a shell or SQL wildcard (,?,% or _) then only &#xNAN;what's matched by the wildcard is shown. If a database name contains any underscores, those should be escaped with a backslash (some Unix shells require two) to get a list of the proper tables or columns. “” and “?” characters are converted into SQL “%” and “” wildcard characters. This might cause some confusion when you try to display the columns for a table with a “” in the name, because in this case, mariadb-show shows you only the table names that match the pattern. This is easily fixed by adding an extra “%” last on the command line as a separate argument.

Options

mariadb-show supports the following options:

Option
Description

-c name, --character-sets-dir=name

Directory for character set files.

-C, --compress

Use compression in server/client protocol if both support it.

--count

Show number of rows per table (may be slow for non-MyISAM tables).

[name], --debug[=name]

Output debug log. Typical is d:t:o,filename, the default is d:t:o.

--debug-check

Check memory and open file usage at exit.

--debug-info

Print some debug info at exit.

--default-auth=name

Default authentication client-side plugin to use.

--default-character-set=name

Set the default character set.

--defaults-extra-file=name

Read the file name after the global files are read. Must be given as the first option.

--defaults-file=name

Only read default options from the given file name. Must be given as the first option.

--defaults-group-suffix=suffix

In addition to the given groups, also read groups with this suffix.

-?, --help

Display help and exit.

-h name, --host=name

Connect to the MariaDB server on the given host.

-k, --keys

Show indexes for table.

--no-defaults

Don't read default options from any option file. Must be given as the first option.

-p[password], --password[=password]

Password to use when connecting to server. If password is not given, it's solicited on the command line. Specifying a password on the command line should be considered insecure. You can use an option file to avoid giving the password on the command line.

-W, --pipe

On Windows, connect to the server via a named pipe. This option applies only if the server supports named-pipe connections.

--plugin-dir=name

Directory for client-side plugins.

-P num, --port=num

Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306).

--print-defaults

Print the program argument list and exit. Must be given as the first option.

--protocol=name

The protocol to use for connection (tcp, socket, pipe, memory).

--shared-memory-base-name=name

On Windows, the shared-memory name to use, for connections made using shared memory to a local server. The default value is MYSQL. The shared-memory name is case sensitive. The server must be started with the --shared-memory option to enable shared-memory connections.

-t, --show-table-type

Show table type column, as in SHOW FULL TABLES. The type is BASE TABLE or VIEW.

-S name, --socket=name

For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.

--ssl

Enables TLS. TLS is also enabled even without setting this option when certain other TLS options are set. Starting with MariaDB 10.2, the --ssl option will not enable verifying the server certificate by default. In order to verify the server certificate, the user must specify the --ssl-verify-server-cert option.

--ssl-ca=name

Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for TLS. This option requires that you use the absolute path, not a relative path. See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option implies the --ssl option.

--ssl-capath=name

Defines a path to a directory that contains one or more PEM files that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for TLS. This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the openssl rehash command. See Secure Connections Overview: Certificate Authorities (CAs) for more information. This option is only supported if the client was built with OpenSSL. If the client was built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms. This option implies the --ssl option.

--ssl-cert=name

Defines a path to the X509 certificate file to use for TLS. This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.

--ssl-cipher=name

List of permitted ciphers or cipher suites to use for TLS. This option implies the --ssl option.

--ssl-key=name

Defines a path to a private key file to use for TLS. This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.

--ssl-crl=name

Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for TLS. This option requires that you use the absolute path, not a relative path. See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information. This option is only supported if the client was built with OpenSSL or Schannel. If the client was built with yaSSL or GnuTLS, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms. This option implies the --ssl option.

--ssl-crlpath=name

Defines a path to a directory that contains one or more PEM files that should each contain one revoked X509 certificate to use for TLS. This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the openssl rehash command. See Secure Connections Overview: Certificate Revocation Lists (CRLs) for more information. This option is only supported if the client was built with OpenSSL. If the client was built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See TLS and Cryptography Libraries Used by MariaDB for more information about which libraries are used on which platforms. This option implies the --ssl option.

--ssl-verify-server-cert

Enables (or disables) server certificate verification. This option is disabled by default.

-i, --status

Shows a lot of extra information about each table. See the INFORMATION_SCHEMA.TABLES table for more details on the returned information.

--tls-version=name

This option accepts a comma-separated list of TLS protocol versions. A TLS protocol version will only be enabled if it is present in this list. All other TLS protocol versions will not be permitted. See Secure Connections Overview: TLS Protocol Versions for more information. This option was added in MariaDB 10.4.6.

-u, --user=name

User for login if not current user.

-v, --verbose

More verbose output; you can use this multiple times to get even more verbose output.

-V, --version

Output version information and exit.

Option Files

In addition to reading options from the command-line, mariadb-show can also read options from option files. If an unknown option is provided to mariadb-show in an option file, then it is ignored.

The following options relate to how MariaDB command-line tools handles option files. They must be given as the first argument on the command-line:

Option
Description

--print-defaults

Print the program argument list and exit.

--no-defaults

Don't read default options from any option file.

--defaults-file=#

Only read default options from the given file #.

--defaults-extra-file=#

Read this file after the global files are read.

--defaults-group-suffix=#

In addition to the default option groups, also read option groups with this suffix.

In MariaDB 10.2 and later, mariadb-show is linked with MariaDB Connector/C. However, MariaDB Connector/C does not yet handle the parsing of option files for this client. That is still performed by the server option file parsing code. See MDEV-19035 for more information.

Option Groups

mariadb-show reads options from the following option groups from option files:

Group
Description

[mysqlshow]

Options read by mysqlshow, which includes both MariaDB Server and MySQL Server.

[mariadb-show]

Options read by mariadb-show. Available starting with MariaDB 10.4.6.

[client]

Options read by all MariaDB and MySQL client programs, which includes both MariaDB and MySQL clients. For example, mysqldump.

[client-server]

Options read by all MariaDB client programs and the MariaDB Server. This is useful for options like socket and port, which is common between the server and the clients.

[client-mariadb]

Options read by all MariaDB client programs.

Examples

Getting a list of databases:

bin/mariadb-show
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| test               |
+--------------------+

Getting a list of tables in the test database:

bin/mariadb-show test
Database: test
+---------+
| Tables  |
+---------+
| author  |
| book    |
| city    |
| country |
+---------+

Getting a list of columns in the test.book table:

bin/mariadb-show test book
Database: test  Table: book
+-----------+-----------------------+-------------------+------+-----+---------+----------------+--------------------------------+---------+
| Field     | Type                  | Collation         | Null | Key | Default | Extra          | Privileges                      | Comment |
+-----------+-----------------------+-------------------+------+-----+---------+----------------+--------------------------------+---------+
| id        | mediumint(8) unsigned |                   | NO   | PRI |         | auto_increment | select,insert,update,references |         |
| title     | varchar(200)          | latin1_swedish_ci | NO   |     |         |                | select,insert,update,references |         |
| author_id | smallint(5) unsigned  |                   | NO   | MUL |         |                | select,insert,update,references |         |
+-----------+-----------------------+-------------------+------+-----+---------+----------------+--------------------------------+---------+

This page is licensed: CC BY-SA / Gnu FDL

mariadb-plugin

mariadb-plugin is a tool for enabling or disabling plugins.

Prior to MariaDB 10.5, the client was called mysql_plugin. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

It is a commandline alternative to the INSTALL PLUGIN and UNINSTALL PLUGIN statements, and the --plugin-load option to mariadbd.

mariadb-plugin must be run while the server is offline, and works by adding or removing rows from the mysql.plugin table.

mariadb-plugin basically has two use cases:

  • adding a plugin even before the first real server startup

  • removing a plugin that crashes the server on startup

For the install use case, adding a plugin-load-add entry to my.cnf or in a separate include option file, is probably a better alternative. In case of a plugin loaded via a mysql.plugin crashing the server, uninstalling the plugin with the help of mariadb-plugin can be the only viable action though.

Usage

mariadb-plugin [options] <plugin> ENABLE|DISABLE

mariadb-plugin expects to find a configuration file that indicates how to configure the plugins. The configuration file is by default the same name as the plugin, with a .ini extension. For example:

mariadb-plugin crazyplugins ENABLE

Here, mariadb-plugin will look for a file called crazyplugins.ini

crazyplugins
crazyplugin1
crazyplugin2
crazyplugin3

The first line should contain the name of the library object file, with no extension. The other lines list the names of the components. Each value should be on a separate line, and the # character at the start of the line indicates a comment.

Options

The following options can be specified on the command line, while some can be specified in the [mysqld] group of any option file. For options specified in a [mysqld] group, only the --basedir, --datadir, and --plugin-dir options can be used - the rest are ignored.

Option
Description

-b, --basedir=name

The base directory for the server.

-d, --datadir=name

The data directory for the server.

-?, --help

Display help and exit.

-f, --my-print-defaults=name

Path to my_print_defaults executable. Example: /source/temp11/extra

-m, --mysqld=name

Path to mysqld executable. Example: /sbin/temp1/mysql/bin

-n, --no-defaults

Do not read values from configuration file.

-p, --plugin-dir=name

The plugin directory for the server.

-i, --plugin-ini=name

Read plugin information from configuration file specified instead of from /<plugin_name>.ini.

-P, --print-defaults

Show default values from configuration file.

-v, --verbose

More verbose output; you can use this multiple times to get even more verbose output.

-V, --version

Output version information and exit.

See Also

  • List of Plugins

  • Plugin Overview

  • INFORMATION_SCHEMA.PLUGINS Table

  • INSTALL PLUGIN

  • INSTALL SONAME

  • UNINSTALL PLUGIN

  • UNINSTALL SONAME

This page is licensed: CC BY-SA / Gnu FDL

mariadb-report

mariadb-report makes a friendly report of important MariaDB status values.

Prior to MariaDB 10.5, the client was called mysqlreport. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

Actually, mariadb-report makes a friendly report of nearly every status value from SHOW STATUS. Unlike SHOW STATUS which simply dumps over 100 values to the screen in one long list, mariadb-report interprets and formats the values and presents the basic values and many more inferred values in a human-readable format. Numerous example reports are available in the archive of the old hackmysql.com/mysqlreport, archived here.

The benefit of mariadb-report is that it allows you to very quickly see a wide array of performance indicators for your MariaDB server which would otherwise need to be calculated by hand from all the various SHOW STATUS values. For example, the Index Read Ratio is an important value but it's not present in SHOW STATUS; it's an inferred value (the ratio of Key_reads to Key_read_requests).

This documentation outlines all the command line options in mariadb-report, most of which control which reports are printed. This document does not address how to interpret these reports; that topic is covered in the document Guide To Understanding mysqlreport, archived here.

Usage

mariadb-report [options]

mariadb-report options

Technically, command line options are in the form --option, but -option works too. All options can be abbreviated if the abbreviation is unique. For example, option --host can be abbreviated to --ho but not --h because --h is ambiguous: it could mean --host or --help.

Option
Description

--all

Equivalent to --dtq --dms --com 3 --sas --qcache. (Notice --tab is not invoked by --all.)

--com N

Print top N number of non-DMS Com_ status values in descending order (after DMS in Questions report). If N is not given, default is 3. Such non-DMS Com_ values include Com_change_db, Com_show_tables, Com_rollback, etc.

--dms

Print Data Manipulation Statements (DMS) report (under DMS in Questions report). DMS are those from the Data Manipulation section. mariadb-report considers only SELECT, INSERT, REPLACE, UPDATE, and DELETE. Each DMS is listed in descending order by count.

--dtq

Print Distribution of Total Queries (DTQ) report (under Total in Questions report). Queries (or Questions) can be divided into four main areas: DMS (see --dms), Com_ (see --com ), COM_QUIT (see COM_QUIT and Questions, archived here), and Unknown. --dtq lists the number of queries in each of these areas in descending order.

--email ADDRESS

After printing the report to screen, email the report to ADDRESS. This option requires sendmail in /usr/sbin/, therefore it does not work on Windows. /usr/sbin/sendmail can be a sym link to qmail, for example, or any MTA that emulates sendmail's -t command line option and operation. The FROM: field is "mariadb-report", SUBJECT: is "MySQL status report".

--flush-status

Execute a FLUSH STATUS after generating the reports. If you do not have permissions in MariaDB to do this an error from DBD::mysql::st will be printed after the reports.

--help

Output help information and exit.

--host ADDRESS

Host address.

--infile FILE

Instead of getting SHOW STATUS values from MariaDB, read values from FILE. FILE is often a copy of the output of SHOW STATUS including formatting characters (+, -). mariadb-report expects FILE to have the format " value number " where value is only alpha and underscore characters (A-Z and _) and number is a positive integer. Anything before, between, or after value and number is ignored. mariadb-report also needs the following MariaDB server variables: version, table_cache, max_connections, key_buffer_size, query_cache_size. These values can be specified in INFILE in the format "name = value" where name is one of the aforementioned server variables and value is a positive integer with or without a trailing M and possible periods (for version). For example, to specify an 18M key_buffer_size: key_buffer_size = 18M. Or, a 256 table_cache: table_cache = 256. The M implies Megabytes not million, so 18M means 18,874,368 not 18,000,000. If these server variables are not specified the following defaults are used (respectively) which may cause strange values to be reported: 0.0.0, 64, 100, 8M, 0.

--no-mycnf

Makes mariadb-report not read /.my.cnf which it does by default otherwise. --user and --password always override values from /.my.cnf.

--outfile FILE

After printing the report to screen, print the report to FILE too. Internally, mariadb-report always writes the report to a temp file first: /tmp/mysqlreport.PID on *nix, c:sqlreport.PID on Windows (PID is the script's process ID). Then it prints the temp file to screen. Then if --outfile is specified, the temp file is copied to OUTFILE. After --email (above), the temp file is deleted.

--password

As of version 2.3 --password can take the password on the command line like --password FOO. Using --password alone without giving a password on the command line causes mariadb-report to prompt for a password.

--port PORT

Port number.

--qcache

Print Query Cache report.

--sas

Print report for Select_ and Sort_ status values (after Questions report). See MySQL Select and Sort Status Variables, archived here.

--socket SOCKET

For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.

--tab

Print Threads, Aborted, and Bytes status reports (after Created temp report). The Threads report reports on all Threads_ status values.

--user USERNAME

Username.

This page is licensed: CC BY-SA / Gnu FDL

mariadb-find-rows

mariadb-find-rows reads files containing SQL statements and extracts statements that match a given regular expression or that contain USE db_name or SET statements.

Prior to MariaDB 10.5, the client was called mysql_find_rows. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

The utility was written for use with update log files (as used prior to MySQL 5.0) and as such expects statements to be terminated with semicolon (;) characters. It may be useful with other files that contain SQL statements as long as statements are terminated with semicolons.

Usage

mariadb-find-rows [options] [file_name ...]

Each file_name argument should be the name of file containing SQL statements. If no file names are given, mariadb-find-rows reads the standard input.

Options

mariadb-find-rows supports the following options:

Option
Description

--help, --Information

Display help and exit.

--regexp=pattern

Display queries that match the pattern.

--rows=N

Quit after displaying N queries.

--skip-use-db

Do not include USE db_name statements in the output.

--start_row=N

Start output from this row (first row is 1).

Examples

mariadb-find-rows --regexp=problem_table --rows=20 < update.log
mariadb-find-rows --regexp=problem_table  update-log.1 update-log.2

This page is licensed: CC BY-SA / Gnu FDL

mariadb-tzinfo-to-sql

mariadb-tzinfo-to-sql is a utility used to load time zones on systems that have a zoneinfo database to load the time zone tables (time_zone, time_zone_leap_second, time_zone_name, time_zone_transition and time_zone_transition_type) into the mysql database.

Prior to MariaDB 10.5, the client was called mysql_tzinfo_to_sql. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

Most Linux, Mac OS X, FreeBSD and Solaris systems will have a zoneinfo database - Windows does not. The database is commonly found in the /usr/share/zoneinfo directory, or, on Solaris, the /usr/share/lib/zoneinfo directory.

Usage

mariadb-tzinfo-to-sql can be called in several ways. The output is usually passed straight to the mariadb client for direct loading in the mysql database.

shell> mariadb-tzinfo-to-sql timezone_dir
shell> mariadb-tzinfo-to-sql timezone_file timezone_name
shell> mariadb-tzinfo-to-sql --leap timezone_file

Resetting timezone tables

If there is a need to reset the timezone to the default, to before using mariadb-tzinfo-to-sql, one can do that by executing:

truncate table mysql.time_zone;
truncate table mysql.time_zone_name;
truncate table mysql.time_zone_transition;
truncate table mysql.time_zone_transition_type;
truncate table mysql.time_zone_leap_second;

The old timezone values will be in effect until the server is restarted.

Examples

Most commonly, the whole directory is passed:

shell>mariadb-tzinfo-to-sql /usr/share/zoneinfo | mariadb -u root mysql

Load a single time zone file, timezone_file, corresponding to the time zone called timezone_name.

shell> mariadb-tzinfo-to-sql timezone_file timezone_name | mariadb -u root mysql

A separate command for each time zone and time zone file the server needs is required.

To account for leap seconds, use:

shell> mariadb-tzinfo-to-sql --leap timezone_file | mariadb -u root mysql

After populating the time zone tables, you should usually restart the server so that the new time zone data is correctly loaded.

This page is licensed: CC BY-SA / Gnu FDL

mariadb-waitpid

mariadb_waitpid is a utility for terminating processes. It runs on Unix-like systems, making use of the kill() system call.

Prior to MariaDB 10.5, the client was called mysql_waitpid. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

Usage

mariadb-waitpid [options] pid time

Description

mariadb-waitpid sends signal 0 to the process pid and waits up to time seconds for the process to terminate. pid and time must be positive integers.

Returns 0 if the process terminates in time, or does not exist, and 1 otherwise.

Signal 1 is used if the kill() system call cannot handle signal 0

Options

Option
Description

-?, --help

Display help and exit

-I, --help

Synonym for -?

-v, --verbose

Be more verbose. Give a warning, if kill can't handle signal 0

-V, --version

Print version information and exit

This page is licensed: CC BY-SA / Gnu FDL

my_print_defaults

my_print_defaults

my_print_defaults displays the options from option groups of option files. It is useful to see which options a particular tool will use.

Output is one option per line, displayed in the form in which they would be specified on the command line.

Usage

my_print_defaults [OPTIONS] [groups]

Options

Option
Description

-c, --config-file=name

Deprecated, please use --defaults-file instead. Name of config file to read; if no extension is given, default extension (e.g., .ini or .cnf) will be added.

-d, --debug[=#]

In debug versions, write a debugging log. A typical debug_options string is d:t:o,file_name. The default is d:t:o,/tmp/my_print_defaults.trace.

-c, --defaults-file=name

Like --config-file, except: if first option, then read this file only, do not read global or per-user config files; should be the first option. Removed in MariaDB 10.8.0.

-e, --defaults-extra-file=name

Read this file after the global config file and before the config file in the users home directory; should be the first option. Removed in MariaDB 10.8.0.

-g, --defaults-group-suffix=name

In addition to the given groups, read also groups with this suffix. Removed in MariaDB 10.8.0.

-e, --extra-file=name

Deprecated. Synonym for --defaults-extra-file.

--mariadbd

Read the same set of groups that the mariadbd binary does. From MariaDB 10.11.3.

--mysqld

Read the same set of groups that the mysqld binary does.

-n, --no-defaults

Return an empty string (useful for scripts).

?, --help

Display this help message and exit.

-v, --verbose

Increase the output level.

-V, --version

Output version information and exit.

Examples

my_print_defaults --defaults-file=example.cnf client client-server mysql

mariadb-check reads from the [mariadb-check] and [client] sections, so the following would display the mariadb-check options.

my_print_defaults mariadb-check client

This page is licensed: CC BY-SA / Gnu FDL

mariadb-embedded

mariadb-embedded is a mariadb client statically linked to libmariadbd, the embedded server.

Prior to MariaDB 10.5, the client was called mysql_embedded. It can still be accessed under this name, via a symlink in Linux, or an alternate binary in Windows.

Upon execution, an embedded MariaDB server is instantiated and you can execute statements just as you would using the normal mariadb client, using the same options.

Do not run mariadb-embedded using the same database as a running MariaDB server!

Examples

sudo mariadb-embedded -e 'select user, host, password from mysql.user where user="root"'
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | db1       | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | 127.0.0.1 | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | ::1       | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
+------+-----------+-------------------------------------------+

Sending options with --server-arg:

sudo mariadb-embedded --server-arg='--skip-innodb'
  --server-arg='--default-storage-engine=myisam' 
  --server-arg='--log-error=/tmp/mysql.err' 
  -e 'select user, host, password from mysql.user where user="root"'
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | db1       | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | 127.0.0.1 | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| root | ::1       | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
+------+-----------+-------------------------------------------+

This page is licensed: CC BY-SA / Gnu FDL

perror

perror is a utility that displays descriptions for system or storage engine error codes.

See MariaDB Error Codes for a full list of MariaDB error codes, and Operating System Error Codes for a list of Linux and Windows error codes.

Usage

perror [OPTIONS] [ERRORCODE [ERRORCODE...]]

If you need to describe a negative error code, use -- before the first error code to end the options.

Options

Option
Description

-?, --help

Display help and exit.

-I, --info

Synonym for --help.

-s, --silent

Only print the error message.

-v, --verbose

Print error code and message (default). (Defaults to on; use --skip-verbose to disable.)

-V, --version

Displays version information and exits.

Examples

System error code:

shell> perror 96
OS error code  96:  Protocol family not supported

MariaDB/MySQL error code:

shell> perror 1005 1006
MySQL error code 1005 (ER_CANT_CREATE_TABLE): Can't create table %`s.%`s (errno: %M)
MySQL error code 1006 (ER_CANT_CREATE_DB): Can't create database '%-.192s' (errno: %M)
shell> perror --silent 1979
You are not owner of query %lu

This page is licensed: CC BY-SA / Gnu FDL

replace

Description

The replace utility program changes strings in place in files or on the standard input. Invoke replace in one of the following ways:

shell> replace from to [from to] ... -- file_name [file_name] ...
shell> replace from to [from to] ... < file_name

"from" represents a string to look for and "to" represents its replacement. There can be one or more pairs of strings.

A from-string can contain these special characters:

Character
Description

^

Match start of line.

$

Match end of line.

\b

Match space-character, start of line or end of line. For an end \b the next replace starts looking at the end space-character. A \b alone in a string matches only a space-character

Use the -- option to indicate where the string-replacement list ends and the file names begin. Any file named on the command line is modified in place, so you may want to make a copy of the original before converting it. replace prints a message indicating which of the input files it actually modifies.

If the -- option is not given, replace reads standard input and writes to standard output.

replace uses a finite state machine to match longer strings first. It can be used to swap strings. For example, the following command swaps "a" and "b" in the given files, /file1andfile2*:*

shell> replace a b b a -- file1 file2 ...

The replace program is used by msql2mysql.

Options

replace supports the following options.

Option
Description

-?, -I

Display a help message and exit.

-#debug_options

Enable debugging.

-s

Silent mode. Print less information about what the program does.

-v

Verbose mode. Print more information about what the program does.

-V

Display version information and exit.

This page is licensed: CC BY-SA / Gnu FDL

resolve_stack_dump

resolve_stack_dump is a tool that resolves numeric stack strace dumps into symbols.

Usage

resolve_stack_dump [OPTIONS] symbols-file [numeric-dump-file]

The symbols-file should include the output from: nm --numeric-sort mariadbd. The numeric-dump-file should contain a numeric stack trace from mariadbd. If the numeric-dump-file is not given, the stack trace is read from stdin.

Options

Option
Description

-h, --help

Display this help and exit.

-V, --version

Output version information and exit.

-s, --symbols-file=name

Use specified symbols file.

-n, --numeric-dump-file=name

Read the dump from specified file.

This page is licensed: CC BY-SA / Gnu FDL