Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
View server metadata and status. This section lists SHOW statements for inspecting databases, tables, variables, and performance metrics.
List available character sets. View the default collation, maximum length, and description for each supported character set.
SHOW CHARACTER SET
[LIKE 'pattern' | WHERE expr]The SHOW CHARACTER SET statement shows all available . The LIKE clause, if present on its own, indicates which character set names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
The same information can be queried from the table.
See for details on specifying the character set at the server, database, table and column levels.
This page is licensed: GPLv2, originally from
Overview of the SHOW statement syntax. Learn how to use patterns and WHERE clauses to filter output from various SHOW statements.
SHOW provides information about various aspects of MariaDB Server. A list of the various SHOW statements is here.
The general syntax is:
SHOW LIKE 'pattern' | WHERE exprThe LIKE and WHERE clauses make sense only for particular SHOW statements, though. See Extended SHOW for what SHOW statements benefit from using those clauses.
If the syntax for a given SHOW statement includes LIKE 'pattern' , 'pattern' is a
string that can contain the SQL % and _ wildcard characters. The pattern is useful for
restricting statement output to matching values.
This page is licensed: GPLv2, originally from
Inspect the contents of a binary log file. This statement displays the events within a specific binlog, useful for debugging replication issues.
SHOW BINLOG EVENTS
[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]Shows the events in the binary log. If you do not specify log_name, the first binary log is displayed.
This statement requires the privilege.
This statement requires the privilege.
This page is licensed: GPLv2, originally from
List the binary log files on the server. View the file names and sizes to monitor replication logs and manage disk usage.
Understand the extensions to the SHOW statement. Learn how to use WHERE and LIKE clauses to perform complex filtering on metadata results.
The following statements can be extended using a WHERE clause and a LIKE clause to refine the results:
This statement requires the BINLOG MONITOR privilege.
This statement requires the SUPER privilege and the REPLICATION_CLIENT privilege.
This page is licensed: GPLv2, originally from fill_help_tables.sql
The SHOW CLIENT_STATISTICS statement is part of the User Statistics feature. The information_schema.CLIENT_STATISTICS table holds statistics about client connections.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.CLIENT_STATISTICS articles for more information.
This page is licensed: CC BY-SA / Gnu FDL
As with a regular SELECT, the WHERE clause can be used for the specific columns returned, and the LIKE clause with the regular wildcards.
This statement shows all tables:
This statement only shows tables starting with the letter 'a':
This statement shows variables whose names start with aria and have a value greater than 8192:
This page is licensed: CC BY-SA / Gnu FDL
View the current status of the primary server's binary log. This statement returns the current log file name and position for replication synchronization.
SHOW BINLOG STATUSSHOW MASTER STATUSProvides status information about the files of the primary.
This statement requires the privilege.
This statement requires the privilege and the privilege.
To see information about the current in the binary log, use the variable.
This page is licensed: GPLv2, originally from
SHOW BINARY LOGS
SHOW MASTER LOGSSHOW BINARY LOGS;
+--------------------+-----------+
| Log_name | File_size |
+--------------------+-----------+
| mariadb-bin.000001 | 19039 |
| mariadb-bin.000002 | 717389 |
| mariadb-bin.000003 | 300 |
| mariadb-bin.000004 | 333 |
| mariadb-bin.000005 | 899 |
| mariadb-bin.000006 | 125 |
| mariadb-bin.000007 | 18907 |
| mariadb-bin.000008 | 19530 |
| mariadb-bin.000009 | 151 |
| mariadb-bin.000010 | 151 |
| mariadb-bin.000011 | 125 |
| mariadb-bin.000012 | 151 |
| mariadb-bin.000013 | 151 |
| mariadb-bin.000014 | 125 |
| mariadb-bin.000015 | 151 |
| mariadb-bin.000016 | 314 |
+--------------------+-----------+SHOW CLIENT_STATISTICSSHOW CLIENT_STATISTICS\G
*************************** 1. row ***************************
Client: localhost
Total_connections: 35
Concurrent_connections: 0
Connected_time: 708
Busy_time: 2.5557979999999985
Cpu_time: 0.04123740000000002
Bytes_received: 3883
Bytes_sent: 21595
Binlog_bytes_written: 0
Rows_read: 18
Rows_sent: 115
Rows_deleted: 0
Rows_inserted: 0
Rows_updated: 0
Select_commands: 70
Update_commands: 0
Other_commands: 0
Commit_transactions: 1
Rollback_transactions: 0
Denied_connections: 0
Lost_connections: 0
Access_denied: 0
Empty_queries: 35SHOW TABLES;
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
| t1 |
| view1 |
+----------------------+SHOW TABLES WHERE Tables_in_test LIKE 'a%';
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
+----------------------+SHOW VARIABLES WHERE Variable_name LIKE 'aria%' AND Value >8192;
+------------------------------+---------------------+
| Variable_name | Value |
+------------------------------+---------------------+
| aria_checkpoint_log_activity | 1048576 |
| aria_log_file_size | 1073741824 |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_pagecache_buffer_size | 134217728 |
| aria_sort_buffer_size | 134217728 |
+------------------------------+---------------------+SHOW CHARACTER SET LIKE 'latin%';
+---------+-----------------------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+-----------------------------+-------------------+--------+
| latin1 | cp1252 West European | latin1_swedish_ci | 1 |
| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |
| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |
| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |
+---------+-----------------------------+-------------------+--------+SHOW CHARACTER SET WHERE Maxlen LIKE '2';
+---------+---------------------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------------------+-------------------+--------+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |
| euckr | EUC-KR Korean | euckr_korean_ci | 2 |
| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2 |
| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |
| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
+---------+---------------------------+-------------------+--------+SHOW BINLOG EVENTS IN 'mysql_sandbox10019-bin.000002';
+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+
| mysql_sandbox10019-bin.000002 | 4 | Format_desc | 1 | 248 | Server ver: 10.0.19-MariaDB-log, Binlog ver: 4 |
| mysql_sandbox10019-bin.000002 | 248 | Gtid_list | 1 | 273 | [] |
| mysql_sandbox10019-bin.000002 | 273 | Binlog_checkpoint | 1 | 325 | mysql_sandbox10019-bin.000002 |
| mysql_sandbox10019-bin.000002 | 325 | Gtid | 1 | 363 | GTID 0-1-1 |
| mysql_sandbox10019-bin.000002 | 363 | Query | 1 | 446 | CREATE DATABASE blog |
| mysql_sandbox10019-bin.000002 | 446 | Gtid | 1 | 484 | GTID 0-1-2 |
| mysql_sandbox10019-bin.000002 | 484 | Query | 1 | 571 | use `blog`; CREATE TABLE bb (id INT) |
+-------------------------------+-----+-------------------+-----------+-------------+------------------------------------------------+These include:
First the active people in MariaDB are listed.
Then the active people in MySQL.
Last the people that have contributed to MariaDB/MySQL in the past.
The order is somewhat related to importance of the contribution given to the MariaDB project, but this is not 100% accurate. There is still room for improvement and debate...
SHOW CONTRIBUTORS. This list all members and sponsors of the MariaDB Foundation and other sponsors.
This page is licensed: GPLv2, originally from fill_help_tables.sql
It is similar to SHOW PROCEDURE CODE but for stored functions.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW FUNCTION CODE func_nameList queries for which profiling data is available. View the query ID and duration for recent statements when profiling is enabled.
Get the SQL statement to recreate a scheduled event. This statement displays the complete syntax used to define a specific event.
Display the CREATE SERVER statement. This statement shows the configuration details for a defined federated server connection.
Syntax
Description
Shows the statement that created the given server definition.
Example
The SHOW CREATE SERVER statement is not available.
List defined user variables. This statement displays the names and values of variables set in the current session.
See the for details.
This page is licensed: CC BY-SA / Gnu FDL
SHOW AUTHORSSHOW AUTHORS\G
*************************** 1. row ***************************
Name: Michael (Monty) Widenius
Location: Tusby, Finland
Comment: Lead developer and main author
*************************** 2. row ***************************
Name: Sergei Golubchik
Location: Kerpen, Germany
Comment: Architect, Full-text search, precision math, plugin framework, merges etc
*************************** 3. row ***************************
Name: Igor Babaev
Location: Bellevue, USA
Comment: Optimizer, keycache, core work
*************************** 4. row ***************************
Name: Sergey Petrunia
Location: St. Petersburg, Russia
Comment: Optimizer
*************************** 5. row ***************************
Name: Oleksandr Byelkin
Location: Lugansk, Ukraine
Comment: Query Cache (4.0), Subqueries (4.1), Views (5.0)
*************************** 6. row ***************************
Name: Timour Katchaounov
Location: Sofia , Bulgaria
Comment: Optimizer
*************************** 7. row ***************************
Name: Kristian Nielsen
Location: Copenhagen, Denmark
Comment: Replication, Async client prototocol, General buildbot stuff
*************************** 8. row ***************************
Name: Alexander (Bar) Barkov
Location: Izhevsk, Russia
Comment: Unicode and character sets
*************************** 9. row ***************************
Name: Alexey Botchkov (Holyfoot)
Location: Izhevsk, Russia
Comment: GIS extensions, embedded server, precision math
*************************** 10. row ***************************
Name: Daniel Bartholomew
Location: Raleigh, USA
Comment: MariaDB documentation, Buildbot, releases
*************************** 11. row ***************************
Name: Colin Charles
Location: Selangor, Malesia
Comment: MariaDB documentation, talks at a LOT of conferences
*************************** 12. row ***************************
Name: Sergey Vojtovich
Location: Izhevsk, Russia
Comment: initial implementation of plugin architecture, maintained native storage engines (MyISAM, MEMORY, ARCHIVE, etc), rewrite of table cache
*************************** 13. row ***************************
Name: Vladislav Vaintroub
Location: Mannheim, Germany
Comment: MariaDB Java connector, new thread pool, Windows optimizations
*************************** 14. row ***************************
Name: Elena Stepanova
Location: Sankt Petersburg, Russia
Comment: QA, test cases
*************************** 15. row ***************************
Name: Georg Richter
Location: Heidelberg, Germany
Comment: New LGPL C connector, PHP connector
*************************** 16. row ***************************
Name: Jan Lindström
Location: Ylämylly, Finland
Comment: Working on InnoDB
*************************** 17. row ***************************
Name: Lixun Peng
Location: Hangzhou, China
Comment: Multi Source replication
*************************** 18. row ***************************
Name: Olivier Bertrand
Location: Paris, France
Comment: CONNECT storage engine
*************************** 19. row ***************************
Name: Kentoku Shiba
Location: Tokyo, Japan
Comment: Spider storage engine, metadata_lock_info Information schema
*************************** 20. row ***************************
Name: Percona
Location: CA, USA
Comment: XtraDB, microslow patches, extensions to slow log
*************************** 21. row ***************************
Name: Vicentiu Ciorbaru
Location: Bucharest, Romania
Comment: Roles
*************************** 22. row ***************************
Name: Sudheera Palihakkara
Location:
Comment: PCRE Regular Expressions
*************************** 23. row ***************************
Name: Pavel Ivanov
Location: USA
Comment: Some patches and bug fixes
*************************** 24. row ***************************
Name: Konstantin Osipov
Location: Moscow, Russia
Comment: Prepared statements (4.1), Cursors (5.0), GET_LOCK (10.0)
*************************** 25. row ***************************
Name: Ian Gilfillan
Location: South Africa
Comment: MariaDB documentation
*************************** 26. row ***************************
Name: Federico Razolli
Location: Italy
Comment: MariaDB documentation Italian translation
*************************** 27. row ***************************
Name: Guilhem Bichot
Location: Bordeaux, France
Comment: Replication (since 4.0)
*************************** 28. row ***************************
Name: Andrei Elkin
Location: Espoo, Finland
Comment: Replication
*************************** 29. row ***************************
Name: Dmitri Lenev
Location: Moscow, Russia
Comment: Time zones support (4.1), Triggers (5.0)
*************************** 30. row ***************************
Name: Marc Alff
Location: Denver, CO, USA
Comment: Signal, Resignal, Performance schema
*************************** 31. row ***************************
Name: Mikael Ronström
Location: Stockholm, Sweden
Comment: NDB Cluster, Partitioning, online alter table
*************************** 32. row ***************************
Name: Ingo Strüwing
Location: Berlin, Germany
Comment: Bug fixing in MyISAM, Merge tables etc
*************************** 33. row ***************************
Name: Marko Mäkelä
Location: Helsinki, Finland
Comment: InnoDB core developer
...SHOW BINLOG STATUS;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000016 | 475 | | |
+--------------------+----------+--------------+------------------+
SELECT @@global.gtid_binlog_pos;
+--------------------------+
| @@global.gtid_binlog_pos |
+--------------------------+
| 0-1-2 |
+--------------------------+This page is licensed: CC BY-SA / Gnu FDL
SHOW CREATE SERVER server_nameSHOW CREATE SERVER srv1\G
*************************** 1. row ***************************
Server: srv1
Create Server: CREATE SERVER `srv1` FOREIGN DATA WRAPPER mysql
OPTIONS (HOST '172.30.0.58', DATABASE 'db1', USER 'maxscale', PASSWORD 'password');SHOW INNODB STATUSSHOW CREATE EVENT quotes identifiers according to the value of the sql_quote_show_create system variable.
SHOW CREATE EVENT quotes identifiers according to the value of the sql_quote_show_create system variable. Note, however, that the output of this statement is unreliably affected by the sql_quote_show_create system variable.
The information_schema.EVENTS table provides similar, but more complete, information.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE FUNCTION quotes identifiers, according to the value of the sql_quote_show_create system variable.
SHOW CREATE FUNCTION quotes identifiers, according to the value of the sql_quote_show_create system variable. However, the output of this statement is unreliably affected by the sql_quote_show_create system variable.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE USER quotes identifiers according to the value of the sql_quote_show_create system variable.
SHOW GRANTS shows the GRANTS/PRIVILEGES for a user.
SHOW PRIVILEGES shows the privileges supported by MariaDB.
This page is licensed: CC BY-SA / Gnu FDL
SHOW EVENTSTo see the event action, use SHOW CREATE EVENT instead, or look at the information_schema.EVENTS table.
To see events for a specific schema, use the FROM clause. For example, to see events for the test schema, use the following statement:
The LIKE clause, if present, indicates which event names to match. The WHERE clause can be given to select rows using more general conditions, as discussed in Extended Show.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW EVENTS [{FROM | IN} schema_name]
[LIKE 'pattern' | WHERE expr]SHOW LOCALES is used to return locales information as part of the Locales plugin. It requires this plugin to be installed to work.
While the information_schema.LOCALES table has 8 columns, the SHOW LOCALES statement will only display 4 of them:
This page is licensed: CC BY-SA / Gnu FDL
SHOW LOCALESThe SHOW WSREP_STATUS statement returns Galera node and cluster status information. It returns the same information as found in the information_schema.WSREP_STATUS table. Only users with the SUPER privilege can access this information.
This page is licensed: CC BY-SA / Gnu FDL
SHOW WSREP_STATUSSHOW CREATE EVENT event_nameSHOW CREATE EVENT test.e_daily\G
*************************** 1. row ***************************
Event: e_daily
sql_mode:
time_zone: SYSTEM
Create Event: CREATE EVENT `e_daily`
ON SCHEDULE EVERY 1 DAY
STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
ON COMPLETION NOT PRESERVE
ENABLE
COMMENT 'Saves total number of sessions then
clears the table each day'
DO BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ciSHOW CREATE FUNCTION func_nameSHOW CREATE FUNCTION VatCents\G
*************************** 1. row ***************************
Function: VatCents
sql_mode:
Create Function: CREATE DEFINER=`root`@`localhost` FUNCTION `VatCents`(price DECIMAL(10,2)) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE x INT;
SET x = price * 114;
RETURN x;
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW CREATE USER [user-name]CREATE USER foo4@test require cipher 'text'
issuer 'foo_issuer' subject 'foo_subject';
SHOW CREATE USER foo4@test\G
*************************** 1. row ***************************
CREATE USER 'foo4'@'test'
REQUIRE ISSUER 'foo_issuer'
SUBJECT 'foo_subject'
CIPHER 'text'CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;
SHOW CREATE USER 'monty'@'localhost';
+------------------------------------------------------------------+
| CREATE USER for monty@localhost |
+------------------------------------------------------------------+
| CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY |
+------------------------------------------------------------------+SELECT CURRENT_USER(), SCHEMA();
+----------------+----------+
| CURRENT_USER() | SCHEMA() |
+----------------+----------+
| jon@ghidora | myschema |
+----------------+----------+
SHOW EVENTS\G
*************************** 1. row ***************************
Db: myschema
Name: e_daily
Definer: jon@ghidora
Time zone: SYSTEM
Type: RECURRING
Execute at: NULL
Interval value: 10
Interval field: SECOND
Starts: 2006-02-09 10:41:23
Ends: NULL
Status: ENABLED
Originator: 0
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ciSHOW EVENTS FROM test;SHOW LOCALES;
+-----+-------+-------------------------------------+------------------------+
| Id | Name | Description | Error_Message_Language |
+-----+-------+-------------------------------------+------------------------+
| 0 | en_US | English - United States | english |
| 1 | en_GB | English - United Kingdom | english |
| 2 | ja_JP | Japanese - Japan | japanese |
| 3 | sv_SE | Swedish - Sweden | swedish |
...SHOW WSREP_STATUS;
+------------+-------------+----------------+--------------+
| Node_Index | Node_Status | Cluster_Status | Cluster_Size |
+------------+-------------+----------------+--------------+
| 0 | Synced | Primary | 3 |
+------------+-------------+----------------+--------------+NameLocationCommentlatin1It displays all members and sponsors of the MariaDB Foundation as well as other financial contributors.
.
SHOW AUTHORS list the authors of MariaDB (including documentation, QA etc).
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE DATABASESHOW CREATE DATABASEWith sql_quote_show_create turned off, the output looks slightly differently:
This page is licensed: GPLv2, originally from fill_help_tables.sql
The SHOW USER_STATISTICS statement is part of the User Statistics feature. The information_schema.USER_STATISTICS table holds statistics about user activity. You can use this table to find out such things as which user is causing the most load and which users are being abusive. You can also use this table to measure how close to capacity the server may be.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.USER_STATISTICS table for more information.
This page is licensed: CC BY-SA / Gnu FDL
Retrieve the CREATE TRIGGER statement. This statement displays the SQL syntax defining a specific trigger and its timing events.
This statement shows a CREATE TRIGGER statement that creates the given trigger, as well as the SQL_MODE that was used when the trigger has been created and the character set used by the connection.
The privilege is required on the table the trigger is defined for to execute this statement.
SHOW CREATE TRIGGER quotes identifiers, according to the value of the system variable.
SHOW CREATE TRIGGER quotes identifiers, according to the value of the system variable. However, the output of this statement is unreliably affected by the system variable.
The Created column serves to better view multiple trigger events.
The Created column is unavailable.
This page is licensed: GPLv2, originally from
List plugins and their library files. View information about installed plugins and their associated shared object names.
SHOW PLUGINS SONAME { library | LIKE 'pattern' | WHERE expr };SHOW PLUGINS SONAME displays information about compiled-in and all server plugins in the directory, including plugins that haven't been installed.
There is also a corresponding table, called , which contains more complete information.
This page is licensed: CC BY-SA / Gnu FDL
List stored package bodies. View metadata about the implementation part of Oracle-compatible packages.
The SHOW PACKAGE BODY STATUS statement returns characteristics of stored package bodies (implementations), such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, , displays information about stored package specifications.
The LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
The in the INFORMATION_SCHEMA database contains more detailed information.
This page is licensed: CC BY-SA / Gnu FDL
Display errors from the last executed statement. View error codes, messages, and types for recent failures.
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW ERRORS [LIMIT row_count OFFSET offset]
SHOW COUNT(*) ERRORSThis statement is similar to SHOW WARNINGS, except that instead of displaying errors, warnings, and notes, it displays only errors.
The LIMIT clause has the same syntax as for the statement.
The SHOW COUNT(*) ERRORS statement displays the number of errors. You can also retrieve this number from the variable.
The value of might be greater than the number of messages displayed by if the system variable is set so low that not all messages are stored.
For a list of MariaDB error codes, see MariaDB Error Codes.
This page is licensed: GPLv2, originally from
View the distribution of query execution times. This statement groups queries into time-based buckets to analyze performance.
Display the internal instruction representation of a stored procedure. This debug statement shows the low-level opcodes of the routine.
SHOW PROCEDURE CODE proc_nameThis statement is a MariaDB extension that is available only for servers that have been built with debugging support. It displays a representation of the internal implementation of the named . A similar statement, , displays information about .
Both statements require that you be the owner of the routine or have access to the table.
If the named routine is available, each statement produces a result set. Each row in the result set corresponds to one "instruction" in the routine. The first column is Pos, which is an ordinal number beginning with 0. The second column is Instruction, which contains an SQL statement (usually changed from the original source), or a directive which has meaning only to the stored-routine handler.
This page is licensed: GPLv2, originally from
List currently open tables. View the database, table name, and lock status for tables in the table cache.
SHOW OPEN TABLES lists the non-TEMPORARY tables that are currently open in the table cache. See .
The FROM and LIKE clauses may be used.
The FROM clause, if present, restricts the tables shown to those present in thedb_name database.
The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
The following information is returned:
LOCK TABLE... WRITE acquires a strong MDL lock, and concurrent connections will wait on this MDL lock, so any subsequent LOCK TABLE... WRITE will not increment In_use.
Before , each use of, for example, would increment In_use for that table. With the implementation of the metadata locking improvements in MariaDB 5.5, LOCK TABLE... WRITE acquires a strong MDL lock, and concurrent connections will wait on this MDL lock, so any subsequent LOCK TABLE... WRITE will not increment In_use.
This page is licensed: GPLv2, originally from
View usage statistics for tables. This statement displays metrics like rows read, changed, and updated for each table.
SHOW TABLE_STATISTICSThe SHOW TABLE_STATISTICS statement is part of the feature. It was effectively replaced by the generic SHOW TABLE STATISTICS statement. The table shows statistics on table usage.
The SHOW TABLE_STATISTICS statement is part of the feature. The table shows statistics on table usage.
The system variable must be set to 1 to activate this feature. See the and articles for more information.
This page is licensed: CC BY-SA / Gnu FDL
View Galera Cluster membership. This statement displays the UUID, name, and address of nodes in the cluster.
SHOW WSREP_MEMBERSHIP is part of the WSREP_INFO plugin.
SHOW WSREP_MEMBERSHIPThe SHOW WSREP_MEMBERSHIP statement returns node cluster membership information. It returns the same information as found in the table. Only users with the privilege can access this information.
This page is licensed: CC BY-SA / Gnu FDL
List stored packages. View metadata about the interface part of Oracle-compatible packages in the database.
The SHOW PACKAGE STATUS statement returns characteristics of stored package specifications, such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, , displays information about stored package bodies (i.e. implementations).
The LIKE clause, if present, indicates which package names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
The in the INFORMATION_SCHEMA database contains more detailed information.
This page is licensed: CC BY-SA / Gnu FDL
View the CREATE PACKAGE statement. This statement returns the interface definition of a stored package in MariaDB.
SHOW CREATE PACKAGE [ db_name . ] package_nameThe SHOW CREATE PACKAGE statement can be used when is set. It shows the CREATE statement that creates the given package specification.
SHOW CREATE PACKAGE quotes identifiers according to the value of the system variable.
This page is licensed: CC BY-SA / Gnu FDL
Display the CREATE VIEW statement. This statement shows the SQL query that defines a specific view structure.
View usage statistics for table indexes. This statement displays how often specific indexes are used, helping optimize query performance.
SHOW CONTRIBUTORSSHOW CONTRIBUTORS;
+---------------------+-------------------------------+-------------------------------------------------------------+
| Name | Location | Comment |
+---------------------+-------------------------------+-------------------------------------------------------------+
| Alibaba Cloud | https://www.alibabacloud.com/ | Platinum Sponsor of the MariaDB Foundation |
| Tencent Cloud | https://cloud.tencent.com | Platinum Sponsor of the MariaDB Foundation |
| Microsoft | https://microsoft.com/ | Platinum Sponsor of the MariaDB Foundation |
| MariaDB Corporation | https://mariadb.com | Founding member, Platinum Sponsor of the MariaDB Foundation |
| ServiceNow | https://servicenow.com | Platinum Sponsor of the MariaDB Foundation |
| Intel | https://www.intel.com | Platinum Sponsor of the MariaDB Foundation |
| SIT | https://sit.org | Platinum Sponsor of the MariaDB Foundation |
| Visma | https://visma.com | Gold Sponsor of the MariaDB Foundation |
| DBS | https://dbs.com | Gold Sponsor of the MariaDB Foundation |
| IBM | https://www.ibm.com | Gold Sponsor of the MariaDB Foundation |
| Automattic | https://automattic.com | Silver Sponsor of the MariaDB Foundation |
| Percona | https://www.percona.com/ | Sponsor of the MariaDB Foundation |
| Galera Cluster | https://galeracluster.com | Sponsor of the MariaDB Foundation |
| Google | USA | Sponsoring encryption, parallel replication and GTID |
| Facebook | USA | Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc |
| Ronald Bradford | Brisbane, Australia | EFF contribution for UC2006 Auction |
| Sheeri Kritzer | Boston, Mass. USA | EFF contribution for UC2006 Auction |
| Mark Shuttleworth | London, UK. | EFF contribution for UC2006 Auction |
+---------------------+-------------------------------+-------------------------------------------------------------+SHOW CREATE {DATABASE | SCHEMA} db_nameSHOW CREATE DATABASE test;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+
SHOW CREATE SCHEMA test;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+SHOW CREATE DATABASE test;
+----------+---------------------------------------------------------------+
| Database | Create Database |
+----------+---------------------------------------------------------------+
| test | CREATE DATABASE test /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+---------------------------------------------------------------+SHOW USER_STATISTICSSHOW USER_STATISTICS\G
*************************** 1. row ***************************
User: root
Total_connections: 1
Concurrent_connections: 0
Connected_time: 3297
Busy_time: 0.14113400000000006
Cpu_time: 0.017637000000000003
Bytes_received: 969
Bytes_sent: 22355
Binlog_bytes_written: 0
Rows_read: 10
Rows_sent: 67
Rows_deleted: 0
Rows_inserted: 0
Rows_updated: 0
Select_commands: 7
Update_commands: 0
Other_commands: 0
Commit_transactions: 1
Rollback_transactions: 0
Denied_connections: 0
Lost_connections: 0
Access_denied: 0
Empty_queries: 7SHOW CREATE TRIGGER trigger_nameSHOW PACKAGE BODY STATUS
[LIKE 'pattern' | WHERE expr]SHOW OPEN TABLES [FROM db_name]
[LIKE 'pattern' | WHERE expr]SHOW PACKAGE STATUS
[LIKE 'pattern' | WHERE expr]SHOW PLUGINS SONAME 'ha_example.so';
+----------+---------------+----------------+---------------+---------+
| Name | Status | Type | Library | License |
+----------+---------------+----------------+---------------+---------+
| EXAMPLE | NOT INSTALLED | STORAGE ENGINE | ha_example.so | GPL |
| UNUSABLE | NOT INSTALLED | DAEMON | ha_example.so | GPL |
+----------+---------------+----------------+---------------+---------+SHOW QUERY_RESPONSE_TIME;
+----------------+-------+----------------+
| Time | Count | Total |
+----------------+-------+----------------+
| 0.000001 | 0 | 0.000000 |
| 0.000010 | 17 | 0.000094 |
| 0.000100 | 4301 0.236555 |
| 0.001000 | 1499 | 0.824450 |
| 0.010000 | 14851 | 81.680502 |
| 0.100000 | 8066 | 443.635693 |
| 1.000000 | 0 | 0.000000 |
| 10.000000 | 0 | 0.000000 |
| 100.000000 | 1 | 55.937094 |
| 1000.000000 | 0 | 0.000000 |
| 10000.000000 | 0 | 0.000000 |
| 100000.000000 | 0 | 0.000000 |
| 1000000.000000 | 0 | 0.000000 |
| TOO LONG | 0 | TOO LONG |
+----------------+-------+----------------+Server_id: The unique server ID of the replica server, as configured in the server's option file, or on the command line with --server-id=value.Host: The host name of the replica server, as configured in the server's option file, or on the command line with --report-host=host_name (note that this can differ from the machine name as configured in the operating system). If a replica doesn't configure --report-host explicitly, the value for the Host column is automatically extracted using the network connection's host name or IP address.
Host: The host name of the replica server, as configured in the server's option file, or on the command line with --report-host=host_name (note that this can differ from the machine name as configured in the operating system). If a replica doesn't configure --report-host explicitly, the value for the Host column is automatically extracted using the network connection's host name or IP address. The Host value is left blank if a replica's --report-host parameter is not configured.
Port: The port the replica server is listening on.
Master_id: The unique server ID of the primary server that the replica server is replicating from.
Requires the REPLICATION MASTER ADMIN privilege.
Requires the REPLICATION SLAVE privilege.
SHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS .
SHOW REPLICA HOSTS is not available, use SHOW SLAVE HOSTS instead.
SHOW PROCESSLIST. In SHOW PROCESSLIST output, replica threads are identified by Binlog Dump
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE VIEW quotes table, column and stored function names according to the value of the sql_quote_show_create server system variable.
With sql_quote_show_create off:
This page is licensed: GPLv2, originally from fill_help_tables.sql
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.
The information_schema.ROUTINES table contains more detailed information.
Showing all stored functions:
Stored functions whose name starts with 'V':
Stored functions with a security type of 'DEFINER':
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW FUNCTION STATUS
[LIKE 'pattern' | WHERE expr]LIKE clause, if present, indicates which variable names to match. The WHERE clause can be given to select rows using more general conditions.With the GLOBAL modifier, SHOW STATUS displays the status values for all connections to MariaDB. WithSESSION, it displays the status values for the current connection. If no modifier is present, the default isSESSION. LOCAL is a synonym forSESSION. If you see a lot of 0 values, the reason is probably that you have used SHOW STATUS with a new connection instead of SHOW GLOBAL STATUS.
Some status variables have only a global value. For these, you get the same value for both GLOBAL and SESSION.
See Server Status Variables for a full list, scope and description of the variables that can be viewed with SHOW STATUS.
The LIKE clause, if present on its own, indicates which variable name to match.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.
Example of filtered output:
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE TRIGGER example\G
*************************** 1. row ***************************
Trigger: example
sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES
,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_
ENGINE_SUBSTITUTION
SQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example BEFORE
INSERT ON t FOR EACH ROW
BEGIN
SET NEW.c = NEW.c * 2;
END
character_set_client: cp850
collation_connection: cp850_general_ci
Database Collation: utf8_general_ci
Created: 2016-09-29 13:53:34.35SHOW COUNT(*) ERRORS;
SELECT @@error_count;SELECT f();
ERROR 1305 (42000): FUNCTION f does not exist
SHOW COUNT(*) ERRORS;
+-----------------------+
| @@session.error_count |
+-----------------------+
| 1 |
+-----------------------+
SHOW ERRORS;
+-------+------+---------------------------+
| Level | Code | Message |
+-------+------+---------------------------+
| Error | 1305 | FUNCTION f does not exist |
+-------+------+---------------------------+DELIMITER //
CREATE PROCEDURE p1 ()
BEGIN
DECLARE fanta INT DEFAULT 55;
DROP TABLE t2;
LOOP
INSERT INTO t3 VALUES (fanta);
END LOOP;
END//
Query OK, 0 rows affected (0.00 sec)
SHOW PROCEDURE CODE p1//
+-----+----------------------------------------+
| Pos | Instruction |
+-----+----------------------------------------+
| 0 | set fanta@0 55 |
| 1 | stmt 9 "DROP TABLE t2" |
| 2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |
| 3 | jump 2 |
+-----+----------------------------------------+SHOW TABLE_STATISTICS\G
*************************** 1. row ***************************
Table_schema: mysql
Table_name: proxies_priv
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 2. row ***************************
Table_schema: test
Table_name: employees_example
Rows_read: 7
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 3. row ***************************
Table_schema: mysql
Table_name: user
Rows_read: 16
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 4. row ***************************
Table_schema: mysql
Table_name: db
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0SHOW WSREP_MEMBERSHIP;
+-------+--------------------------------------+----------+-----------------+
| Index | Uuid | Name | Address |
+-------+--------------------------------------+----------+-----------------+
| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |
| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |
| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |
+-------+--------------------------------------+----------+-----------------+SHOW CREATE PACKAGE employee_tools\G
*************************** 1. row ***************************
Package: employee_tools
sql_mode: PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
Create Package: CREATE DEFINER="root"@"localhost" PACKAGE "employee_tools" AS
FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);
PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));
PROCEDURE raiseSalaryStd(eid INT);
PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW { REPLICA | SLAVE } HOSTSSHOW REPLICA HOSTS;
+------------+-----------+------+-----------+
| Server_id | Host | Port | Master_id |
+------------+-----------+------+-----------+
| 192168010 | iconnect2 | 3306 | 192168011 |
| 1921680101 | athena | 3306 | 192168011 |
+------------+-----------+------+-----------+SHOW CREATE VIEW [view-name]SHOW CREATE VIEW example\G
*************************** 1. row ***************************
View: example
Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL
SECURITY DEFINER VIEW `example` AS (select `t`.`id` AS `id`,`t`.`s` AS `s` from
`t`)
character_set_client: cp850
collation_connection: cp850_general_ciSHOW CREATE VIEW example\G
*************************** 1. row ***************************
View: example
Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECU
RITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from t)
character_set_client: cp850
collation_connection: cp850_general_ciGRANT SHOW VIEW,SELECT ON test_database.test_view TO 'test'@'localhost';SHOW FUNCTION STATUS\G
*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW FUNCTION STATUS LIKE 'V%' \G
*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW FUNCTION STATUS WHERE Security_type LIKE 'DEFINER' \G
*************************** 1. row ***************************
Db: test
Name: VatCents
Type: FUNCTION
Definer: root@localhost
Modified: 2013-06-01 12:40:31
Created: 2013-06-01 12:40:31
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW [GLOBAL | SESSION] STATUS
[LIKE 'pattern' | WHERE expr]SHOW GLOBAL STATUS;
+--------------------------------------------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------------+----------------------------------------+
| Aborted_clients | 0 |
| Aborted_connects | 0 |
| Access_denied_errors | 0 |
| Acl_column_grants | 0 |
| Acl_database_grants | 2 |
| Acl_function_grants | 0 |
| Acl_procedure_grants | 0 |
| Acl_proxy_users | 2 |
| Acl_role_grants | 0 |
| Acl_roles | 0 |
| Acl_table_grants | 0 |
| Acl_users | 6 |
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 15706 |
...
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0 |
+--------------------------------------------------------------+----------------------------------------+
516 rows in set (0.00 sec)SHOW STATUS LIKE 'Key%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107163 |
| Key_blocks_used | 0 |
| Key_blocks_warm | 0 |
| Key_read_requests | 0 |
| Key_reads | 0 |
| Key_write_requests | 0 |
| Key_writes | 0 |
+------------------------+--------+
8 rows in set (0.00 sec)On replicas, this command shows the events in the relay log. If 'log_name' is not specified, the first relay log is shown.
Syntax for the LIMIT clause is the same as for SELECT ... LIMIT.
Using the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS command returns the complete contents of the relay log, which can be quite large.
This command does not return events related to setting user and system variables. If you need those, use mariadb-binlog.
On the primary, this command does nothing.
Requires the REPLICA MONITOR privilege.
Requires the REPLICA MONITOR privilege (>= ), the REPLICATION SLAVE ADMIN privilege (>= ) or the REPLICATION SLAVE privilege (<= ).
If there is only one nameless primary, or the default primary (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the SHOW RELAYLOG statement will apply to the specified primary. connection_name is case-insensitive.
The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly after SHOW RELAYLOG.
FOR CHANNEL is not available.
This page is licensed: CC BY-SA / Gnu FDL
Library column indicates the plugin library - if it is NULL, the plugin is built-in and cannot be uninstalled.The PLUGINS table in the information_schema database contains more detailed information.
For specific information about storage engines (a particular type of plugin), see the information_schema.ENGINES table and the SHOW ENGINES statement.
(all plugins, installed or not)
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW INDEX_STATISTICS is replaced by the generic SHOW TABLE STATISTICS statement.
The SHOW INDEX_STATISTICS statement was introduced in as part of the User Statistics feature. It was removed as a separate statement in , but effectively replaced by the generic SHOW TABLE STATISTICS statement.
The userstat system variable must be set to 1 to activate this feature. See the User Statistics and information_schema.INDEX_STATISTICS table for more information.
This page is licensed: CC BY-SA / Gnu FDL
Database
Database name.
Name
Table name.
In_use
Number of table instances being used.
Name_locked
1 if the table is name-locked, e.g. if it is being dropped or renamed, otherwise 0.
Display information about columns in a table. View field names, types, default values, and other attributes for a specific table.
SHOW COLUMNS displays information about the columns in a given table. It also works for views. The LIKE clause, if present on its own, indicates which column names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
If the data types differ from what you expect them to be based on aCREATE TABLE statement, note that MariaDB sometimes changes data types when you create or alter a table. The conditions under which this occurs are described in the article.
The FULL keyword causes the output to include the column collation and comments, as well as the privileges you have for each column.
You can use db_name.tbl_name as an alternative to thetbl_name FROM db_name syntax. In other words, these two statements are equivalent:
SHOW COLUMNS displays the following values for each table column:
Field indicates the column name.
Type indicates the column data type.
Collation indicates the collation for non-binary string columns, or NULL for other columns. This value is displayed only if you use the FULL keyword.
The Null field contains YES if NULL values can be stored in the column, NO if not.
The Key field indicates whether the column is indexed:
If Key is empty, the column either is not indexed or is indexed only as a secondary column in a multiple-column, non-unique index.
If Key is PRI, the column is a PRIMARY KEY or is one of the columns in a multiple-column PRIMARY KEY.
If Key is UNI, the column is the first column of a unique-valued index that cannot contain NULL values.
If more than one of the Key values applies to a given column of a table, Key displays the one with the highest priority, in the order PRI, UNI, MUL.
A UNIQUE index may be displayed as PRI if it cannot contain NULL values and there is noPRIMARY KEY in the table. A UNIQUE index may display as MUL if several columns form a compositeUNIQUE index; although the combination of the columns is unique, each column can still hold multiple occurrences of a given value.
The Default field indicates the default value that is assigned to the column.
The Extra field contains any additional information that is available about a given column.
Privileges indicates the privileges you have for the column. This value is displayed only if you use the FULL keyword.
Comment indicates any comment the column has. This value is displayed only if you use the FULL keyword.
SHOW FIELDS is a synonym forSHOW COLUMNS. Also and can be used as shortcuts.
You can also list a table's columns with:
See the command for more details.
The statement provides information similar to SHOW COLUMNS. The table provides similar, but more complete, information.
The , , and statements also provide information about tables.
This page is licensed: GPLv2, originally from
List available collations. View the character set associated with each collation and identifying properties like ID and default status.
The output from SHOW COLLATION includes all available . The LIKE clause, if present on its own, indicates which collation names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
Similar information, including some extra information, can be queried from the table.
No similar information or extra information can be queried from the table.
See for details on specifying the collation at the server, database, table and column levels.
The pad_attribute column (not shown in the examples below) has a value of NO PAD or PAD SPACE. This attribute affects whether trailing spaces are significant in string comparisons. See the table description for more information.
The pad_attribute column is not available.
This page is licensed: GPLv2, originally from
View privileges assigned to a user. This statement displays the GRANT statements required to replicate a user's permissions.
The SHOW GRANTS statement lists privileges granted to a particular user or role.
The statement lists the statement or statements that must be issued to duplicate the privileges that are granted to a MariaDB user account. The account is named using the same format as for theGRANT statement; for example, 'jeffrey'@'localhost'. If you specify only the user name part of the account name, a host name part of '%' is used. For additional information about specifying account names, see .
To list the privileges granted to the account that you are using to connect to the server, you can use any of the following statements:
If SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in DEFINER context (such as within a stored procedure that is defined withSQL SECURITY DEFINER), the grants displayed are those of the definer and not the invoker.
SHOW GRANTS can also be used to view the privileges granted to a .
FOR PUBLIC
grants privileges to all users. SHOW GRANTS FOR PUBLIC shows all these grants.
FOR PUBLIC is not available.
shows how the user was created.
shows the privileges supported by MariaDB.
This page is licensed: GPLv2, originally from
List stored procedures and their characteristics. View metadata like the database, name, type, and creator of stored procedures.
This statement is a MariaDB extension. It returns characteristics of a stored procedure, such as the database, name, type, creator, creation and modification dates, and character set information. A similar statement, , displays information about stored functions.
The LIKE clause, if present, indicates which procedure or function names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
The in the INFORMATION_SCHEMA database contains more detailed information.
This page is licensed: GPLv2, originally from
List databases on the MariaDB server. View the names of all databases available to the current user.
SHOW DATABASES lists the databases on the MariaDB server host.SHOW SCHEMAS is a synonym forSHOW DATABASES. The LIKE clause, if present on its own, indicates which database names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
You see only those databases for which you have some kind of privilege, unless you have the global . You can also get this list using the command.
If the server was started with the --skip-show-database option, you cannot use this statement at all unless you have the .
The list of results returned by SHOW DATABASES is based on directories in the data directory, which is how MariaDB implements databases. It's possible that output includes directories that do not correspond to actual databases.
The also contains database information.
This page is licensed: GPLv2, originally from
SHOW RELAYLOG ['connection_name'] EVENTS
[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
[ FOR CHANNEL 'channel_name']SHOW PLUGINS;SHOW PLUGINS;
+----------------------------+----------+--------------------+-------------+---------+
| Name | Status | Type | Library | License |
+----------------------------+----------+--------------------+-------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| Aria | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
...
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| SPHINX | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| pam | ACTIVE | AUTHENTICATION | auth_pam.so | GPL |
+----------------------------+----------+--------------------+-------------+---------+SHOW INDEX_STATISTICSSHOW INDEX_STATISTICS;
+--------------+-------------------+------------+-----------+
| Table_schema | Table_name | Index_name | Rows_read |
+--------------+-------------------+------------+-----------+
| test | employees_example | PRIMARY | 1 |
+--------------+-------------------+------------+-----------+SHOW PACKAGE BODY STATUS LIKE 'pkg1'\G
*************************** 1. row ***************************
Db: test
Name: pkg1
Type: PACKAGE BODY
Definer: root@localhost
Modified: 2018-02-27 14:44:14
Created: 2018-02-27 14:44:14
Security_type: DEFINER
Comment: This is my first package body
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW OPEN TABLES;
+----------+---------------------------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+---------------------------+--------+-------------+
...
| test | xjson | 0 | 0 |
| test | jauthor | 0 | 0 |
| test | locks | 1 | 0 |
...
+----------+---------------------------+--------+-------------+SHOW PACKAGE STATUS LIKE 'pkg1'\G
*************************** 1. row ***************************
Db: test
Name: pkg1
Type: PACKAGE
Definer: root@localhost
Modified: 2018-02-27 14:38:15
Created: 2018-02-27 14:38:15
Security_type: DEFINER
Comment: This is my first package
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]
[LIKE 'pattern' | WHERE expr]SHOW COLLATION
[LIKE 'pattern' | WHERE expr]SHOW GRANTS [FOR user|role]SHOW PROCEDURE STATUS
[LIKE 'pattern' | WHERE expr]SHOW {DATABASES | SCHEMAS}
[LIKE 'pattern' | WHERE expr]In the DEFAULT clause of a SHOW CREATE statement, numbers are quoted.
If Key is MUL, multiple occurrences of a given value are allowed within the column. The column is the first column of a non-unique index or a unique-valued index that can contain NULL values.
AUTO_INCREMENT
The column was created with the AUTO_INCREMENT keyword.
PERSISTENT
The column was created with the PERSISTENT keyword.
VIRTUAL
The column was created with the VIRTUAL keyword.
on update CURRENT_TIMESTAMP
The column is a TIMESTAMP column that is automatically updated on INSERT and UPDATE.
SHOW COLLATION LIKE 'utf8mb4_bin';
+-------------+---------+------+---------+----------+---------+---------------+
| Collation | Charset | Id | Default | Compiled | Sortlen | Pad_attribute |
+-------------+---------+------+---------+----------+---------+---------------+
| utf8mb4_bin | utf8mb4 | 46 | | Yes | 1 | PAD SPACE |
+-------------+---------+------+---------+----------+---------+---------------+Profiling is controlled by the profiling session variable, which has a default value of 0 (OFF). Profiling is enabled by setting profiling to 1 or ON:
SHOW PROFILES displays a list of the most recent statements sent to the master. The size of the list is controlled by the profiling_history_size session variable, which has a default value of 15. The maximum value is 100. Setting the value to 0 has the practical effect of disabling profiling.
All statements are profiled except SHOW PROFILES andSHOW PROFILE, so you will find neither of those statements in the profile list. Malformed statements are profiled. For example,SHOW PROFILING is an illegal statement, and a syntax error occurs if you try to execute it, but it will show up in the profiling list.
SHOW PROFILE displays detailed information about a single statement. Without the FOR QUERY n clause, the output pertains to the most recently executed statement. IfFOR QUERY n is included,SHOW PROFILE displays information for statement n. The values of n correspond to the Query_ID values displayed by SHOW PROFILES.
The LIMIT row_count clause may be given to limit the output to row_count rows. If LIMIT is given,OFFSET offset may be added to begin the output offset rows into the full set of rows.
By default, SHOW PROFILE displays Status and Duration columns. The Status values are like the State values displayed by SHOW PROCESSLIST (see General Thread States), although there might be some minor differences in interpretation for the two statements for some status values.
Optional type values may be specified to display specific additional types of information:
ALL displays all information
BLOCK IO displays counts for block input and output operations
CONTEXT SWITCHES displays counts for voluntary and involuntary context switches
CPU displays user and system CPU usage times
IPC displays counts for messages sent and received
MEMORY is not currently implemented
PAGE FAULTS displays counts for major and minor page faults
SOURCE displays the names of functions from the source code, together with the name and line number of the file in which the function occurs
SWAPS displays swap counts
Profiling is enabled per session. When a session ends, its profiling information is lost.
The information_schema.PROFILING table contains similar information.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE TABLE quotes table and column names according to the value of the sql_quote_show_create server system variable.
Certain SQL_MODE values can result in parts of the original CREATE statement not being included in the output. MariaDB-specific table options, column options, and index options are not included in the output of this statement if the NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are used. All MariaDB-specific table attributes are also not shown when a non-MariaDB/MySQL emulation mode is used, which includes ANSI, DB2, POSTGRESQL, MSSQL, MAXDB or ORACLE.
Invalid table options, column options and index options are normally commented out (note, that it is possible to create a table with invalid options, by altering a table of a different engine, where these options were valid). To have them uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember that replaying a CREATE TABLE statement with uncommented invalid options will fail with an error, unless the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.
Note that SHOW CREATE TABLE is not meant to provide metadata about a table. It provides information about how the table was declared, but the real table structure could differ a bit. For example, if an index has been declared as HASH, the CREATE TABLE statement returned by SHOW CREATE TABLE will declare that index as HASH; however, it is possible that the index is in fact a BTREE, because the storage engine does not support HASH.
MariaDB permits TEXT and BLOB data types to be assigned a DEFAULT value. As a result, SHOW CREATE TABLE will append a DEFAULT NULL to nullable TEXT or BLOB fields if no specific default is provided.
Numbers are quoted in the DEFAULT clause in SHOW CREATE statement.
Numbers are not quoted in the DEFAULT clause in SHOW CREATE statement.
Indexes are sorted and displayed in the following order, which may differ from the order of the CREATE TABLE statement.
PRIMARY KEY
UNIQUE keys where all column are NOT NULL
UNIQUE keys that don't contain partial segments
Other UNIQUE keys
LONG UNIQUE keys
Normal keys
Fulltext keys
See sql/sql_table.cc for details.
With sql_quote_show_create off:
SQL_MODE impacting the output:
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW CREATE SEQUENCE quotes identifiers according to the value of the sql_quote_show_create system variable.
If you want to see the underlying table structure used for the SEQUENCE you can use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the current recorded state of the SEQUENCE:
The Information Schema SEQUENCES Table also provides information about available sequences:
This page is licensed: CC BY-SA / Gnu FDL
will produce an EXPLAIN output for the query that connection number connection_id is running. The connection id can be obtained with SHOW PROCESSLIST.
The output is always accompanied with a warning which shows the query the target connection is running (this shows what the EXPLAIN is for):
EXPLAIN FOR CONNECTION
The EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.
FORMAT=JSON
SHOW EXPLAIN [FORMAT=JSON] FOR <connection_id> extends SHOW EXPLAIN to return more detailed JSON output.
EXPLAIN FOR CONNECTION and FORMAT=JSON are not available.
The output can be only produced if the target connection is currently running a query, which has a ready query plan. If this is not the case, the output will be:
You will get this error when:
The target connection is not running a command for which one can run EXPLAIN;
The target connection is running a command for which one can run EXPLAIN, but there is no query plan yet (for example, tables are open and locks are acquired before the query plan is produced).
In MySQL, EXPLAIN execution takes a slightly different route from the way the real query (typically the SELECT) is optimized. This is unfortunate, and has caused a number of bugs in EXPLAIN. (For example, see MDEV-326, MDEV-410, and lp:1013343.lp:992942 is not directly about EXPLAIN, but it also would not have existed if MySQL didn't try to delete parts of a query plan in the middle of the query)
SHOW EXPLAIN examines a running SELECT, and hence its output may be slightly different from what EXPLAIN SELECT would produce. We did our best to make sure that either the difference is negligible, or SHOW EXPLAIN's output is closer to reality than EXPLAIN's output.
SHOW EXPLAIN may have Extra='no matching row in const table', where EXPLAIN would produce Extra='Impossible WHERE ...'
For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY where regular EXPLAIN used to print select_type==SIMPLE, or vice versa.
Running SHOW EXPLAIN requires the same permissions as running SHOW PROCESSLIST would.
EXPLAIN ANALYZE, which will perform a query and outputs enhanced EXPLAIN results.
It is also possible to save EXPLAIN into the slow query log.
This page is licensed: CC BY-SA / Gnu FDL
SHOW COLUMNS FROM mytable FROM mydb;
SHOW COLUMNS FROM mydb.mytable;mariadb-show db_name tbl_nameSHOW COLUMNS FROM city;
+------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+----------------+
| Id | int(11) | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| Country | char(3) | NO | UNI | | |
| District | char(20) | YES | MUL | | |
| Population | int(11) | NO | | 0 | |
+------------+----------+------+-----+---------+----------------+SHOW COLUMNS FROM employees WHERE Type LIKE 'Varchar%';
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| first_name | varchar(30) | NO | MUL | NULL | |
| last_name | varchar(40) | NO | | NULL | |
| position | varchar(25) | NO | | NULL | |
| home_address | varchar(50) | NO | | NULL | |
| home_phone | varchar(12) | NO | | NULL | |
| employee_code | varchar(25) | NO | UNI | NULL | |
+---------------+-------------+------+-----+---------+-------+SHOW COLLATION LIKE 'latin1%';
+-------------------------+---------+------+---------+----------+---------+
| Collation | Charset | Id | Default | Compiled | Sortlen |
+-------------------------+---------+------+---------+----------+---------+
| latin1_german1_ci | latin1 | 5 | | Yes | 1 |
| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 |
| latin1_danish_ci | latin1 | 15 | | Yes | 1 |
| latin1_german2_ci | latin1 | 31 | | Yes | 2 |
| latin1_bin | latin1 | 47 | | Yes | 1 |
| latin1_general_ci | latin1 | 48 | | Yes | 1 |
| latin1_general_cs | latin1 | 49 | | Yes | 1 |
| latin1_spanish_ci | latin1 | 94 | | Yes | 1 |
| latin1_swedish_nopad_ci | latin1 | 1032 | | Yes | 1 |
| latin1_nopad_bin | latin1 | 1071 | | Yes | 1 |
+-------------------------+---------+------+---------+----------+---------+SHOW COLLATION WHERE Sortlen LIKE '8' AND Charset LIKE 'utf8mb4';
+------------------------------+---------+------+---------+----------+---------+
| Collation | Charset | Id | Default | Compiled | Sortlen |
+------------------------------+---------+------+---------+----------+---------+
| utf8mb4_unicode_ci | utf8mb4 | 224 | | Yes | 8 |
| utf8mb4_icelandic_ci | utf8mb4 | 225 | | Yes | 8 |
| utf8mb4_latvian_ci | utf8mb4 | 226 | | Yes | 8 |
| utf8mb4_romanian_ci | utf8mb4 | 227 | | Yes | 8 |
| utf8mb4_slovenian_ci | utf8mb4 | 228 | | Yes | 8 |
| utf8mb4_polish_ci | utf8mb4 | 229 | | Yes | 8 |
| utf8mb4_estonian_ci | utf8mb4 | 230 | | Yes | 8 |
| utf8mb4_spanish_ci | utf8mb4 | 231 | | Yes | 8 |
| utf8mb4_swedish_ci | utf8mb4 | 232 | | Yes | 8 |
| utf8mb4_turkish_ci | utf8mb4 | 233 | | Yes | 8 |
| utf8mb4_czech_ci | utf8mb4 | 234 | | Yes | 8 |
| utf8mb4_danish_ci | utf8mb4 | 235 | | Yes | 8 |
| utf8mb4_lithuanian_ci | utf8mb4 | 236 | | Yes | 8 |
| utf8mb4_slovak_ci | utf8mb4 | 237 | | Yes | 8 |
| utf8mb4_spanish2_ci | utf8mb4 | 238 | | Yes | 8 |
| utf8mb4_roman_ci | utf8mb4 | 239 | | Yes | 8 |
| utf8mb4_persian_ci | utf8mb4 | 240 | | Yes | 8 |
| utf8mb4_esperanto_ci | utf8mb4 | 241 | | Yes | 8 |
| utf8mb4_hungarian_ci | utf8mb4 | 242 | | Yes | 8 |
| utf8mb4_sinhala_ci | utf8mb4 | 243 | | Yes | 8 |
| utf8mb4_german2_ci | utf8mb4 | 244 | | Yes | 8 |
| utf8mb4_croatian_mysql561_ci | utf8mb4 | 245 | | Yes | 8 |
| utf8mb4_unicode_520_ci | utf8mb4 | 246 | | Yes | 8 |
| utf8mb4_vietnamese_ci | utf8mb4 | 247 | | Yes | 8 |
| utf8mb4_croatian_ci | utf8mb4 | 608 | | Yes | 8 |
| utf8mb4_myanmar_ci | utf8mb4 | 609 | | Yes | 8 |
| utf8mb4_unicode_nopad_ci | utf8mb4 | 1248 | | Yes | 8 |
| utf8mb4_unicode_520_nopad_ci | utf8mb4 | 1270 | | Yes | 8 |
+------------------------------+---------+------+---------+----------+---------+SHOW GRANTS FOR 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();SHOW GRANTS FOR journalist;
+------------------------------------------+
| Grants for journalist |
+------------------------------------------+
| GRANT USAGE ON *.* TO 'journalist' |
| GRANT DELETE ON `test`.* TO 'journalist' |
+------------------------------------------+SHOW GRANTS FOR public;
+------------------------------------------------+
| Grants for PUBLIC |
+------------------------------------------------+
| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |
+------------------------------------------------+SHOW PROCEDURE STATUS LIKE 'p1'\G
*************************** 1. row ***************************
Db: test
Name: p1
Type: PROCEDURE
Definer: root@localhost
Modified: 2010-08-23 13:23:03
Created: 2010-08-23 13:23:03
Security_type: DEFINER
Comment:
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ciSHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+SHOW DATABASES LIKE 'm%';
+---------------+
| Database (m%) |
+---------------+
| mysql |
+---------------+SHOW PROFILE [type [, type] ... ]
[FOR QUERY n]
[LIMIT row_count [OFFSET offset]]
type:
ALL
| BLOCK IO
| CONTEXT SWITCHES
| CPU
| IPC
| MEMORY
| PAGE FAULTS
| SOURCE
| SWAPSSET profiling = 1;SELECT @@profiling;
+-------------+
| @@profiling |
+-------------+
| 0 |
+-------------+
SET profiling = 1;
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE T1 (id INT);
SHOW PROFILES;
+----------+------------+--------------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------------+
| 1 | 0.00009200 | SELECT DATABASE() |
| 2 | 0.00023800 | show databases |
| 3 | 0.00018900 | show tables |
| 4 | 0.00014700 | DROP TABLE IF EXISTS t1 |
| 5 | 0.24476900 | CREATE TABLE T1 (id INT) |
+----------+------------+--------------------------+
SHOW PROFILE;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000042 |
| checking permissions | 0.000044 |
| creating table | 0.244645 |
| After create | 0.000013 |
| query end | 0.000003 |
| freeing items | 0.000016 |
| logging slow query | 0.000003 |
| cleaning up | 0.000003 |
+----------------------+----------+
SHOW PROFILE FOR QUERY 4;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000126 |
| query end | 0.000004 |
| freeing items | 0.000012 |
| logging slow query | 0.000003 |
| cleaning up | 0.000002 |
+--------------------+----------+
SHOW PROFILE CPU FOR QUERY 5;
+----------------------+----------+----------+------------+
| Status | Duration | CPU_user | CPU_system |
+----------------------+----------+----------+------------+
| starting | 0.000042 | 0.000000 | 0.000000 |
| checking permissions | 0.000044 | 0.000000 | 0.000000 |
| creating table | 0.244645 | 0.000000 | 0.000000 |
| After create | 0.000013 | 0.000000 | 0.000000 |
| query end | 0.000003 | 0.000000 | 0.000000 |
| freeing items | 0.000016 | 0.000000 | 0.000000 |
| logging slow query | 0.000003 | 0.000000 | 0.000000 |
| cleaning up | 0.000003 | 0.000000 | 0.000000 |
+----------------------+----------+----------+------------+SHOW CREATE TABLE tbl_nameSHOW CREATE TABLE t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`s` char(60) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1SHOW CREATE TABLE t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE t (
id int(11) NOT NULL AUTO_INCREMENT,
s char(60) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1SELECT @@sql_mode;
+-------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------+
CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`msg` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
;
SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`msg` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET SQL_MODE=ORACLE;
SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE "t1" (
"id" int(11) NOT NULL,
"msg" varchar(100) DEFAULT NULL,
PRIMARY KEY ("id")SHOW CREATE SEQUENCE sequence_name;CREATE SEQUENCE s1 START WITH 50;
SHOW CREATE SEQUENCE s1\G;
*************************** 1. row ***************************
Table: s1
Create Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue 9223372036854775806
increment by 1 cache 1000 nocycle ENGINE=InnoDBSHOW CREATE TABLE s1\G
*************************** 1. row ***************************
Table: s1
Create Table: CREATE TABLE `s1` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created
or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed,
1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
SELECT * FROM s1\G
*************************** 1. row ***************************
next_not_cached_value: 50
minimum_value: 1
maximum_value: 9223372036854775806
start_value: 50
increment: 1
cache_size: 1000
cycle_option: 0
cycle_count: 0SELECT * FROM INFORMATION_SCHEMA.SEQUENCES\G
*************************** 1. row ***************************
SEQUENCE_CATALOG: def
SEQUENCE_SCHEMA: test
SEQUENCE_NAME: s1
DATA_TYPE: bigint
NUMERIC_PRECISION: 64
NUMERIC_PRECISION_RADIX: 2
NUMERIC_SCALE: 0
START_VALUE: 50
MINIMUM_VALUE: 1
MAXIMUM_VALUE: 9223372036854775806
INCREMENT: 1
CYCLE_OPTION: 0SHOW EXPLAIN [FORMAT=JSON] FOR <connection_id>;
EXPLAIN [FORMAT=JSON] FOR CONNECTION <connection_id>;SHOW EXPLAIN FOR <connection_id>;SHOW EXPLAIN FOR 1;
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL | 1000107 | Using index |
+------+-------------+-------+-------+---------------+------+---------+------+---------+-------------+
1 row in set, 1 warning (0.00 sec)SHOW WARNINGS;
+-------+------+------------------------+
| Level | Code | Message |
+-------+------+------------------------+
| Note | 1003 | select sum(a) from tbl |
+-------+------+------------------------+
1 row in set (0.00 sec)SHOW EXPLAIN FOR 2;
ERROR 1932 (HY000): Target is not running an EXPLAINable commandCREATE PACKAGE BODYThe SHOW CREATE PACKAGE BODY statement shows the CREATE PACKAGE BODY statement that creates the given package body (that is, the implementation of the package). CREATE PACKAGE BODY can be used when Oracle SQL_MODE is set.
SHOW CREATE PACKAGE BODY quotes identifiers according to the value of the sql_quote_show_create system variable.
This page is licensed: CC BY-SA / Gnu FDL
SHOW PRIVILEGES shows the list of system privileges that the MariaDB server supports. The exact list of privileges depends on the version of your server.
Note that before , and , the Delete history privilege displays as Delete versioning rows (MDEV-20382).
SHOW CREATE USER shows how the user was created.
SHOW GRANTS shows the GRANTS/PRIVILEGES for a user.
This page is licensed: GPLv2, originally from fill_help_tables.sql
The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW. For example, when searching for tables in the test database, the column name for use in the WHERE and LIKE clauses will be Tables_in_test
The FULL modifier is supported such that SHOW FULL TABLES displays a second output column. Values for the second column, Table_type, are BASE TABLE for a table, VIEW for a view and SEQUENCE for a sequence.
You can also get this information using:
See mariadb-show for more details.
If you have no privileges for a base table or view, it does not show up in the output from SHOW TABLES or mariadb-show db_name.
The information_schema.TABLES table, as well as the SHOW TABLE STATUS statement, provide extended information about tables.
Showing the tables beginning with a only.
Showing tables and table types:
Showing temporary tables: <=
From :
This page is licensed: GPLv2, originally from fill_help_tables.sql
FULL keyword, only the first 100 characters of each statement are shown in the Info field.The columns shown in SHOW PROCESSLIST are:
ID
The client's process ID.
USER
The username associated with the process.
HOST
The host the client is connected to.
DB
The default database of the process (NULL if no default).
COMMAND
The command type. See .
TIME
The amount of time, in seconds, the process has been in its current state. For a replica SQL thread before , this is the time in seconds between the last replicated event's timestamp and the replica machine's real time.
The information_schema.PROCESSLIST table contains a number of additional columns. See TIME_MS column in information_schema.PROCESSLIST for differences in the TIME column between MariaDB and MySQL.
Note that the PROGRESS field from the information schema, and the PROGRESS field from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows the total progress, while the information schema shows the progress for the current stage only.
Threads can be killed using their thread_id or their query_id, with the KILL statement.
Since queries on this table are locking, if the performance_schema is enabled, you may want to query the THREADS table instead.
This page is licensed: GPLv2, originally from fill_help_tables.sql
FROMSHOW TRIGGERS lists the triggers currently defined for tables in a database (the default database unless a FROM clause is given). This statement requires the SUPER privilege.
The LIKE clause, if present on its own, indicates which table names to match and causes the statement to display triggers for those tables. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.
Similar information is stored in the information_schema.TRIGGERS table.
If there are multiple triggers for the same action, then the triggers are shown in action order.
For the trigger defined at Trigger Overview:
Listing all triggers associated with a certain table:
character_set_client is the session value of the character_set_client system variable when the trigger was created.
collation_connection is the session value of the collation_connection system variable when the trigger was created.
Database Collation is the collation of the database with which the trigger is associated.
character_set_client, collation_connection, andDatabase Collation are not available.
This page is licensed: GPLv2, originally from fill_help_tables.sql
If the Sphinx Storage Engine is installed, the following is also supported:
SHOW ENGINE INNODB STATUS displays extensive information from the standard InnoDB Monitor about the state of the InnoDB storage engine. See SHOW ENGINE INNODB STATUS for more.
SHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.
The statement displays the following output fields:
Type: Always InnoDB.
Name: The source file where the mutex is implemented, and the line number in the file where the mutex is created. The line number is dependent on the MariaDB version.
Status: This field displays the following values if UNIV_DEBUG was defined at compilation time (for example, in include/univ.h in the InnoDB part of the source tree). Only the os_waits value is displayed if UNIV_DEBUG was not defined. Without UNIV_DEBUG, the information on which the output is based is insufficient to distinguish regular mutexes and mutexes that protect rw-locks (which allow multiple readers or a single writer). Consequently, the output may appear to contain multiple rows for the same mutex.
count indicates how many times the mutex was requested.
spin_waits indicates how many times the spinlock had to run.
spin_rounds indicates the number of spinlock rounds. (spin_rounds divided by spin_waits provides the average round count.)
os_waits indicates the number of operating system waits. This occurs when the spinlock did not work (the mutex was not locked during the spinlock and it was necessary to yield to the operating system and wait).
Information from this statement can be used to diagnose system problems. For example, large values of spin_waits and spin_rounds may indicate scalability problems.
The information_schema.INNODB_MUTEXES table provides similar information.
This statement shows how much memory is used for performance_schema tables and internal buffers.
The output contains the following fields:
Type: Always performance_schema.
Name: The name of a table, the name of an internal buffer, or the performance_schema word, followed by a dot and an attribute. Internal buffers names are enclosed by parenthesis. performance_schema means that the attribute refers to the whole database (it is a total).
Status: The value for the attribute.
The following attributes are shown, in this order, for all tables:
row_size: The memory used for an individual record. This value will never change.
row_count: The number of rows in the table or buffer. For some tables, this value depends on a server system variable.
memory: For tables and performance_schema, this is the result of row_size * row_count.
For internal buffers, the attributes are:
count
size
See also MyRocks Performance Troubleshooting
This page is licensed: GPLv2, originally from fill_help_tables.sql
List available storage engines. View the support status (default, active, or disabled) and description for each engine.
SHOW [STORAGE] ENGINESSHOW ENGINES displays status information about the server's storage engines. This is particularly useful for checking whether a storage engine is supported, or to see what the default engine is.SHOW TABLE TYPES is a deprecated synonym.
The table provides the same information.
Since storage engines are plugins, different information about them is also shown in the table and by the statement.
Note that both MySQL's InnoDB and Percona's XtraDB replacement are labeled as InnoDB. However, if XtraDB is in use, it will be specified in the COMMENT field. See . The same applies to .
The output consists of the following columns:
Engine indicates the engine's name.
Support indicates whether the engine is installed, and whether it is the default engine for the current session.
Comment is a brief description.
This page is licensed: GPLv2, originally from
Get the CREATE PROCEDURE statement. This statement returns the SQL syntax used to define a specific stored procedure.
This statement is a MariaDB extension. It returns the exact string that can be used to re-create the named stored procedure, as well as the SQL_MODE that was used when the trigger has been created and the character set used by the connection.. A similar statement, , displays information about .
Both statements require that:
you are the owner of the routine;
you have the privilege (from ); or
you have the privilege on the table.
When none of the above statements are true, the statements display NULL for the Create Procedure or Create Function field.
Users with SELECT privileges on or USAGE privileges on *.* can view the text of routines, even when they do not have privileges for the function or procedure itself.
SHOW CREATE PROCEDURE quotes identifiers, according to the value of the system variable.
SHOW CREATE PROCEDURE quotes identifiers, according to the value of the system variable. The output of this statement is unreliably affected by the system variable.
Here's a comparison of the SHOW CREATE PROCEDURE and statements.
When the user issuing the statement does not have privileges on the routine, attempting to the procedure raises Error 1370.
If the user neither has privilege to the routine nor the privilege on table, it raises Error 1305, informing them that the procedure does not exist.
This page is licensed: GPLv2, originally from
View system variables. This statement displays the current values of global or session configuration settings.
SHOW VARIABLES shows the values of MariaDB . This does not include user-defined variables - see for details on viewing those.
System variable information can also be obtained using the command. The LIKE clause, if present, indicates which variable names to match. The WHERE clause can be given to select rows using more general conditions.
With the GLOBAL modifier, SHOW VARIABLES displays the values that are used for new connections to MariaDB. With SESSION, it displays the values that are in effect for the current connection. If no modifier is present, the default is SESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement displays only rows for those variables with names that match the pattern. To obtain the row for a specific variable, use a LIKE clause as shown:
To get a list of variables whose name match a pattern, use the "%" wildcard character in a LIKE clause:
Wildcard characters can be used in any position within the pattern to be matched. Strictly speaking, because "_" is a wildcard that matches any single character, you should escape it as "\_" to match it literally. In practice, this is rarely necessary.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
See for information on setting server system variables.
See for a list of all the variables that can be set.
You can also see the server variables by querying the tables.
Because the following variable only has a global scope, the global value is returned even when specifying SESSION (in this case by default):
This page is licensed: GPLv2, originally from
Display warnings from the last executed statement. View warning codes, messages, and levels for recent operations.
SHOW WARNINGS shows the error, warning, and note messages that resulted from the last statement that generated messages in the current session. It shows nothing if the last statement used a table and generated no messages. (That is, a statement that uses a table but generates no messages clears the message list.) Statements that do not use tables and do not generate messages have no effect on the message list.
SHOW CREATE PACKAGE BODY [ db_name . ] package_nameSHOW CREATE PACKAGE BODY employee_tools\G
*************************** 1. row ***************************
Package body: employee_tools
sql_mode: PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
Create Package Body: CREATE DEFINER="root"@"localhost" PACKAGE BODY "employee_tools" AS
stdRaiseAmount DECIMAL(10,2):=500;
PROCEDURE log (eid INT, ecmnt TEXT) AS
BEGIN
INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);
END;
PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS
eid INT;
BEGIN
INSERT INTO employee (name, salary) VALUES (ename, esalary);
eid:= last_insert_id();
log(eid, 'hire ' || ename);
END;
FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2) AS
nSalary DECIMAL(10,2);
BEGIN
SELECT salary INTO nSalary FROM employee WHERE id=eid;
log(eid, 'getSalary id=' || eid || ' salary=' || nSalary);
RETURN nSalary;
END;
PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2)) AS
BEGIN
UPDATE employee SET salary=salary+amount WHERE id=eid;
log(eid, 'raiseSalary id=' || eid || ' amount=' || amount);
END;
PROCEDURE raiseSalaryStd(eid INT) AS
BEGIN
raiseSalary(eid, stdRaiseAmount);
log(eid, 'raiseSalaryStd id=' || eid);
END;
BEGIN
log(0, 'Session ' || connection_id() || ' ' || current_user || ' started');
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW PRIVILEGESSHOW PRIVILEGES;
+--------------------------+---------------------------------------+--------------------------------------------------------------------+
| Privilege | Context | Comment |
+--------------------------+---------------------------------------+--------------------------------------------------------------------+
| Alter | Tables | To alter the table |
| Alter routine | Functions,Procedures | To alter or drop stored functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables |
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE |
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE |
| Create view | Tables | To create new views |
| Create user | Server Admin | To create new users |
| Delete | Tables | To delete existing rows |
| Delete history | Tables | To delete versioning table historical rows |
| Drop | Databases,Tables | To drop databases, tables, and views |
| Event | Server Admin | To create, alter, drop and execute events |
| Execute | Functions,Procedures | To execute stored routines |
| File | File access on server | To read and write files on the server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess |
| Index | Tables | To create or drop indexes |
| Insert | Tables | To insert data into tables |
| Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain text of currently executing queries |
| Proxy | Server Admin | To make proxy user possible |
| References | Databases,Tables | To have references on tables |
| Reload | Server Admin | To reload or refresh tables, logs and privileges |
| Binlog admin | Server | To purge binary logs |
| Binlog monitor | Server | To use SHOW BINLOG STATUS and SHOW BINARY LOG |
| Binlog replay | Server | To use BINLOG (generated by mariadb-binlog) |
| Replication master admin | Server | To monitor connected slaves |
| Replication slave admin | Server | To start/stop slave and apply binlog events |
| Slave monitor | Server | To use SHOW SLAVE STATUS and SHOW RELAYLOG EVENTS |
| Replication slave | Server Admin | To read binary log events from the master |
| Select | Tables | To retrieve rows from table |
| Show databases | Server Admin | To see all databases with SHOW DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW |
| Shutdown | Server Admin | To shut down the server |
| Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers |
| Create tablespace | Server Admin | To create/alter/drop tablespaces |
| Update | Tables | To update existing rows |
| Set user | Server | To create views and stored routines with a different definer |
| Federated admin | Server | To execute the CREATE SERVER, ALTER SERVER, DROP SERVER statements |
| Connection admin | Server | To bypass connection limits and kill other users' connections |
| Read_only admin | Server | To perform write operations even if @@read_only=ON |
| Usage | Server Admin | No privileges - allow connect only |
+--------------------------+---------------------------------------+--------------------------------------------------------------------+
41 rows in set (0.000 sec)SHOW [FULL] TABLES [FROM db_name]
[LIKE 'pattern' | WHERE expr]mariadb-show db_nameSHOW TABLES;
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
| t1 |
| view1 |
+----------------------+SHOW TABLES WHERE Tables_in_test LIKE 'a%';
+----------------------+
| Tables_in_test |
+----------------------+
| animal_count |
| animals |
| are_the_mooses_loose |
| aria_test2 |
+----------------------+SHOW FULL TABLES;
+----------------+------------+
| Tables_in_test | Table_type |
+----------------+------------+
| s1 | SEQUENCE |
| student | BASE TABLE |
| v1 | VIEW |
+----------------+------------+CREATE TABLE t (t INT(11));
CREATE TEMPORARY TABLE t (t INT(11));
CREATE TEMPORARY TABLE te (t INT(11));
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| t |
+----------------+CREATE TABLE t (t INT(11));
CREATE TEMPORARY TABLE t (t INT(11));
CREATE TEMPORARY TABLE te (t INT(11));
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| te |
| t |
| t |
+----------------+SHOW [FULL] PROCESSLISTSHOW PROCESSLIST;
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+
| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty queue | NULL | 0.000 |
| 4 | root | localhost | NULL | Query | 0 | Table lock | SHOW PROCESSLIST | 0.000 |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+SHOW TRIGGERS [FROM db_name]
[LIKE 'pattern' | WHERE expr]SHOW triggers Like 'animals' \G
*************************** 1. row ***************************
Trigger: the_mooses_are_loose
Event: INSERT
Table: animals
Statement: BEGIN
IF NEW.name = 'Moose' THEN
UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
ELSE
UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
END IF;
END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@localhost
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW TRIGGERS FROM test WHERE `Table` = 'user' \G
*************************** 1. row ***************************
Trigger: user_ai
Event: INSERT
Table: user
Statement: BEGIN END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@%
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW triggers WHERE Event Like 'Insert' \G
*************************** 1. row ***************************
Trigger: the_mooses_are_loose
Event: INSERT
Table: animals
Statement: BEGIN
IF NEW.name = 'Moose' THEN
UPDATE animal_count SET animal_count.animals = animal_count.animals+100;
ELSE
UPDATE animal_count SET animal_count.animals = animal_count.animals+1;
END IF;
END
Timing: AFTER
Created: 2016-09-29 13:53:34.35
sql_mode:
Definer: root@localhost
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: latin1_swedish_ciSHOW ENGINE [engine-name] {STATUS | MUTEX}SHOW ENGINE INNODB STATUS
SHOW ENGINE INNODB MUTEX
SHOW ENGINE PERFORMANCE_SCHEMA STATUS
SHOW ENGINE ROCKSDB STATUSSHOW ENGINE SPHINX STATUSSHOW CREATE PROCEDURE proc_nameSHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]os_yields indicates the number of times a the thread trying to lock a mutex gave up its timeslice and yielded to the operating system (on the presumption that allowing other threads to run will free the mutex so that it can be locked).
os_wait_times indicates the amount of time (in ms) spent in operating system waits, if the timed_mutexes system variable is 1 (ON). If timed_mutexes is 0 (OFF), timing is disabled, so os_wait_times is 0. timed_mutexes is off by default.
Transactions, XA and Savepoints indicate whether transactions, XA transactions and transaction savepoints are supported by the engine.A note is different to a warning in that it only appears if the sql_notes variable is set to 1 (the default), and is not converted to an error if strict mode is enabled.
A related statement, SHOW ERRORS, shows only the errors.
The SHOW COUNT(*) WARNINGS statement displays the total number of errors, warnings, and notes. You can also retrieve this number from the warning_count variable:
The value of warning_count might be greater than the number of messages displayed by SHOW WARNINGS if the max_error_count system variable is set so low that not all messages are stored.
The LIMIT clause has the same syntax as for the SELECT statement.
SHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is internally rewritten by MariaDB.
If the sql_notes server variable is set to 1, Notes are included in the output of SHOW WARNINGS; if it is set to 0, this statement will not show (or count) Notes.
The results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to the client. If you need to access those information in a stored program, you can use the GET DIAGNOSTICS statement instead.
The mariadb client also has a number of options related to warnings. The \W command will show warnings after every statement, while \w will disable this. Starting the client with the --show-warnings option will show warnings after every statement.
MariaDB implements a stored routine error stack trace. SHOW WARNINGS can also be used to show more information. See the example below.
Displaying a stack trace:
SHOW WARNINGS displays a stack trace, showing where the error actually happened:
Line 4 in test.p1 is the OPEN command which actually raised the error.
Line 3 in test.p2 is the CALL statement, calling p1 from p2.
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW ENGINES\G
*************************** 1. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 2. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: FEDERATED
Support: YES
Comment: FederatedX pluggable storage engine
Transactions: YES
XA: NO
Savepoints: YES
*************************** 6. row ***************************
Engine: MRG_MyISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 7. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 8. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 9. row ***************************
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
*************************** 10. row ***************************
Engine: Aria
Support: YES
Comment: Crash-safe tables with MyISAM heritage
Transactions: NO
XA: NO
Savepoints: NO
10 rows in set (0.00 sec)SHOW VARIABLES LIKE 'maria_group_commit';
SHOW SESSION VARIABLES LIKE 'maria_group_commit';SHOW VARIABLES LIKE '%maria%';
SHOW GLOBAL VARIABLES LIKE '%maria%';SHOW VARIABLES LIKE 'aria%';
+------------------------------------------+---------------------+
| Variable_name | Value |
+------------------------------------------+---------------------+
| aria_block_size | 8192 |
| aria_checkpoint_interval | 30 |
| aria_checkpoint_log_activity | 1048576 |
| aria_force_start_after_recovery_failures | 0 |
| aria_group_commit | none |
| aria_group_commit_interval | 0 |
| aria_log_file_size | 1073741824 |
| aria_log_purge_type | immediate |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_page_checksum | ON |
| aria_pagecache_age_threshold | 300 |
| aria_pagecache_buffer_size | 134217728 |
| aria_pagecache_division_limit | 100 |
| aria_recover | NORMAL |
| aria_repair_threads | 1 |
| aria_sort_buffer_size | 134217728 |
| aria_stats_method | nulls_unequal |
| aria_sync_log_dir | NEWFILE |
| aria_used_for_temp_tables | ON |
+------------------------------------------+---------------------+SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM
INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 64 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+
SET GLOBAL max_error_count=128;
SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM
INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 128 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+
SET GLOBAL max_error_count=128;
SHOW VARIABLES LIKE 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 64 |
+-----------------+-------+
SHOW GLOBAL VARIABLES LIKE 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 128 |
+-----------------+-------+SHOW VARIABLES LIKE 'innodb_sync_spin_loops';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| innodb_sync_spin_loops | 30 |
+------------------------+-------+SHOW WARNINGS [LIMIT [offset,] row_count]
SHOW ERRORS [LIMIT row_count OFFSET offset]
SHOW COUNT(*) WARNINGSSHOW COUNT(*) WARNINGS;
SELECT @@warning_count;SELECT 1/0;
+------+
| 1/0 |
+------+
| NULL |
+------+
SHOW COUNT(*) WARNINGS;
+-------------------------+
| @@session.warning_count |
+-------------------------+
| 1 |
+-------------------------+
SHOW WARNINGS;
+---------+------+---------------+
| Level | Code | Message |
+---------+------+---------------+
| Warning | 1365 | Division by 0 |
+---------+------+---------------+DELIMITER $$
CREATE OR REPLACE PROCEDURE p1()
BEGIN
DECLARE c CURSOR FOR SELECT * FROM not_existing;
OPEN c;
CLOSE c;
END;
$$
CREATE OR REPLACE PROCEDURE p2()
BEGIN
CALL p1;
END;
$$
DELIMITER ;
CALL p2;
ERROR 1146 (42S02): Table 'test.not_existing' doesn't exist
SHOW WARNINGS;
+-------+------+-----------------------------------------+
| Level | Code | Message |
+-------+------+-----------------------------------------+
| Error | 1146 | Table 'test.not_existing' doesn't exist |
| Note | 4091 | At line 6 in test.p1 |
| Note | 4091 | At line 4 in test.p2 |
+-------+------+-----------------------------------------+STATE
See Thread States.
INFO
The statement being executed.
PROGRESS
The total progress of the process (0-100%) (see Progress Reporting).
View extensive status information for the InnoDB engine. This statement displays details on deadlocks, buffer pool usage, and I/O activity.
SHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that displays the InnoDB Monitor output, which is extensive InnoDB information which can be useful in diagnosing problems.
The following sections are displayed
Status: Shows the timestamp, monitor name and the number of seconds, or the elapsed time between the current time and the time the InnoDB Monitor output was last displayed. The per-second averages are based upon this time.
BACKGROUND THREAD: srv_master_thread lines show work performed by the main background thread.
SEMAPHORES: Threads waiting for a semaphore and stats on how the number of times threads have needed a spin or a wait on a mutex or rw-lock semaphore. If this number of threads is large, there may be I/O or contention issues. Reducing the size of the system variable may help if contention is related to thread scheduling. Spin rounds per wait shows the number of spinlock rounds per OS wait for a mutex.
LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key constraint error, it displays the failed statement and information about the constraint and the related tables.
LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it displays the transactions involved in the deadlock and the statements being executed, held and required locked and the transaction rolled back to.
TRANSACTIONS: The output of this section can help identify lock contention, as well as reasons for the deadlocks.
FILE I/O: InnoDB thread information as well as pending I/O operations and I/O performance statistics.
INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for the ) and adaptive hash index status information, including the number of each type of operation performed, and adaptive hash index performance.
LOG: InnoDB log information, including current log sequence number, how far the log has been flushed to disk, the position at which InnoDB last took a checkpoint, pending writes and write performance statistics.
BUFFER POOL AND MEMORY: Information on buffer pool pages read and written, which allows you to see the number of data file I/O operations performed by your queries. See for more. Similar information is also available from the table.
ROW OPERATIONS:Information about the main thread, including the number and performance rate for each type of row operation.
If the system variable is set to 1, extended lock information will be displayed.
Example output:
This page is licensed: CC BY-SA / Gnu FDL
List index information for a table. View key names, column sequences, cardinality, and other index attributes.
SHOW INDEX returns table index information. The format resembles that of the SQLStatistics call in ODBC.
You can use db_name.tbl_name as an alternative to thetbl_name FROM db_name syntax. These two statements are equivalent:
SHOW KEYS and SHOW INDEXES are synonyms for SHOW INDEX.
You can also list a table's indexes with the command:
The table stores similar information.
The following fields are returned by SHOW INDEX.
The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in .
This page is licensed: GPLv2, originally from
SHOW CREATE PROCEDURE test.simpleproc\G
*************************** 1. row ***************************
Procedure: simpleproc
sql_mode:
Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t;
END
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci
SHOW CREATE FUNCTION test.hello\G
*************************** 1. row ***************************
Function: hello
sql_mode:
Create Function: CREATE FUNCTION `hello`(s CHAR(20))
RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!')
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ciCALL test.prc1();
Error 1370 (42000): execute command denied to
user 'test_user'@'localhost' for routine 'test'.'prc1'SHOW CREATE TABLES test.prc1\G
Error 1305 (42000): PROCEDURE prc1 does not existSHOW ENGINE INNODB STATUSSHOW {INDEX | INDEXES | KEYS}
FROM tbl_name [FROM db_name]
[WHERE expr]=====================================
2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 4 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle
srv_master_thread log flush and writes: 83682
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 15
OS WAIT ARRAY INFO: signal count 8
RW-shared spins 0, rounds 20, OS waits 7
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 236
Purge done for trx's n:o < 236 undo n:o < 0 state: running
History list length 22
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421747401994584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421747401990328, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
286 OS file reads, 171 OS file writes, 22 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
insert 0, delete mark 0, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 445926
Log flushed up to 445926
Pages flushed up to 445926
Last checkpoint at 445917
0 pending log flushes, 0 pending chkp writes
18 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 167772160
Dictionary memory allocated 50768
Buffer pool size 8012
Free buffers 7611
Database pages 401
Old database pages 0
Modified db pages 0
Percent of dirty pages(LRU & free pages): 0.000
Max dirty pages percent: 75.000
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 264, created 137, written 156
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 401, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=4267, Main thread ID=140272021272320, state: sleeping
Number of rows inserted 1, updated 0, deleted 0, read 1
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================Cardinality
Estimated number of unique values in the index. The cardinality statistics are calculated at various times, and can help the optimizer make improved decisions.
Sub_part
NULL if the entire column is included in the index, or the number of included characters if not.
Packed
NULL if the index is not packed, otherwise how the index is packed.
Null
NULL if NULL values are permitted in the column, an empty string if NULLs are not permitted.
Index_type
The index type, which can be BTREE, FULLTEXT, HASH or RTREE. See .
Comment
Other information, such as whether the index is disabled.
Index_comment
Contents of the COMMENT attribute when the index was created.
Ignored
Whether or not an index will be ignored by the optimizer. See . From .
Table
Table name
Non_unique
1 if the index permits duplicate values, 0 if values must be unique.
Key_name
Index name. The primary key is always named PRIMARY.
Seq_in_index
The column's sequence in the index, beginning with 1.
Column_name
Column name.
Collation
Either A, if the column is sorted in ascending order in the index, or NULL if it's not sorted.
SHOW TABLE STATUS works like SHOW TABLES, but provides more extensive information about each table. Only non-TEMPORARY tables are shown.
The LIKE clause, if present on its own, indicates which table names to match. The WHERE and LIKE clauses can be given to select rows using more general conditions, as discussed in Extended SHOW.
The following information is returned:
Name
Table name.
Engine
Table .
Version
Version number from the table's .frm file.
Row_format
Row format (see , and row formats).
Rows
Number of rows in the table. Some engines, such as may store an estimate.
Avg_row_length
Average row length in the table.
Similar information can be found in the information_schema.TABLES table as well as by using mariadb-show:
For views, all columns in SHOW TABLE STATUS are NULL except 'Name' and 'Comment'
This page is licensed: GPLv2, originally from fill_help_tables.sql
SHOW INDEX FROM mytable FROM mydb;
SHOW INDEX FROM mydb.mytable;mariadb-show -k db_name tbl_nameCREATE TABLE IF NOT EXISTS `employees_example` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(30) NOT NULL,
`last_name` VARCHAR(40) NOT NULL,
`position` VARCHAR(25) NOT NULL,
`home_address` VARCHAR(50) NOT NULL,
`home_phone` VARCHAR(12) NOT NULL,
`employee_code` VARCHAR(25) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `employee_code` (`employee_code`),
KEY `first_name` (`first_name`,`last_name`)
) ENGINE=Aria;
INSERT INTO `employees_example` (`first_name`, `last_name`, `position`, `home_address`, `home_phone`, `employee_code`)
VALUES
('Mustapha', 'Mond', 'Chief Executive Officer', '692 Promiscuous Plaza', '326-555-3492', 'MM1'),
('Henry', 'Foster', 'Store Manager', '314 Savage Circle', '326-555-3847', 'HF1'),
('Bernard', 'Marx', 'Cashier', '1240 Ambient Avenue', '326-555-8456', 'BM1'),
('Lenina', 'Crowne', 'Cashier', '281 Bumblepuppy Boulevard', '328-555-2349', 'LC1'),
('Fanny', 'Crowne', 'Restocker', '1023 Bokanovsky Lane', '326-555-6329', 'FC1'),
('Helmholtz', 'Watson', 'Janitor', '944 Soma Court', '329-555-2478', 'HW1');SHOW INDEXES FROM employees_example\G
*************************** 1. row ***************************
Table: employees_example
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 6
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 2. row ***************************
Table: employees_example
Non_unique: 0
Key_name: employee_code
Seq_in_index: 1
Column_name: employee_code
Collation: A
Cardinality: 6
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 3. row ***************************
Table: employees_example
Non_unique: 1
Key_name: first_name
Seq_in_index: 1
Column_name: first_name
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NO
*************************** 4. row ***************************
Table: employees_example
Non_unique: 1
Key_name: first_name
Seq_in_index: 2
Column_name: last_name
Collation: A
Cardinality: NULL
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
Ignored: NOSHOW TABLE STATUS [{FROM | IN} db_name]
[LIKE 'pattern' | WHERE expr]mariadb-show --status db_nameSHOW TABLE STATUS\G
*************************** 1. row ***************************
Name: bus_routes
Engine: InnoDB
Version: 10
Row_format: Dynamic
Rows: 5
Avg_row_length: 3276
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2017-05-24 11:17:46
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:Data_length
Max_data_length
Maximum length of the data file, ie the total number of bytes that could be stored in the table. Not used in InnoDB.
Index_length
Length of the index file.
Data_free
Bytes allocated but unused. For InnoDB tables in a shared tablespace, the free space of the shared tablespace with small safety margin. An estimate in the case of partitioned tables - see the PARTITIONS table.
Auto_increment
Next AUTO_INCREMENT value.
Create_time
Time the table was created. Some engines just return the ctime information from the file system layer here, in that case the value is not necessarily the table creation time but rather the time the file system metadata for it had last changed.
Update_time
Time the table was last updated. On Windows, the timestamp is not updated on update, so MyISAM values will be inaccurate. In InnoDB, if shared tablespaces are used, will be NULL, while buffering can also delay the update, so the value will differ from the actual time of the last UPDATE, INSERT or DELETE.
Check_time
Time the table was last checked. Not kept by all storage engines, in which case will be NULL.
Collation
Checksum
Live checksum value, if any.
Create_options
Extra CREATE TABLE options.
Comment
Table comment provided when MariaDB created the table.
Max_index_length
Maximum index length (supported by MyISAM and Aria tables).
Temporary
Until , placeholder to signal that a table is a temporary table and always "N", except "Y" for generated information_schema tables and NULL for views. From , will also be set to "Y" for local temporary tables.
Retrieve runtime statistics for a currently executing query. This statement provides insights into query plan execution without waiting for completion.
SHOW ANALYZE allows one to retrieve -like output from a currently running statement. The statement
connects to the query running in connection connection_id, gets information about the query plan it is executing, also gets information about the runtime statistics of the execution so far and returns it in a format similar to ANALYZE [FORMAT=JSON] output.
This is similar to the command, the difference being that SHOW ANALYZE also produces runtime statistics information.
You're trying to troubleshoot a query that never finishes. Since it doesn't finish, it is not possible to get output for it. With SHOW ANALYZE, you can get the runtime statistics without waiting for the query to finish.
Consider the tables orders and customer and a join query finding the total amount of orders from customers with Gold status:
The output of this query looks like this:
We run the SELECT, and it has been running for 30 seconds. Let's try SHOW ANALYZE:
The statement shows how long the query has been running.
rows shows the number of rows expected. r_rows in shows how many rows were processed so far (110K out of expected 200K). r_loops shows we're doing the first table scan (which is obvious for this query plan).
rows: 1 shows the optimizer was expecting 1 order per customer. But r_rows: 99.9 shows that it has found on average 100 orders per customer. This may be the reason the query is slower than expected.
The final chunk of the output doesn't have anything interesting but here it is:
Regular SELECT queries collect row count information, so SHOW ANALYZE can display it. However, detailed timing information is not collected, as collecting it may have CPU overhead. But if the target query is collecting timing information, SHOW ANALYZE will display it. How does one get the target query to collect timing information? Currently there is one way: if the target is running ANALYZE, it IS collecting timing information.
Re-running the previous example:
ANALYZE prints timing information in members named r_..._time_ms.
You can see that, so far, out of 30 seconds, only 232 millisecond were spent in reading the customer table. The bottleneck is elsewhere...
29.4 seconds were spent reading the orders table (and 0.986 seconds in processing the obtained rows). Now we can see where the query is spending time.
This page is licensed: CC BY-SA / Gnu FDL
SHOW ANALYZE [FORMAT=JSON] FOR <connection_id>;SHOW ANALYZE [FORMAT=JSON] FOR <connection_id>;EXPLAIN format=json
SELECT sum(orders.amount)
FROM
customer JOIN orders ON customer.cust_id=orders.cust_id
WHERE
customer.status='GOLD';+------+-------------+----------+------+---------------+---------+---------+------------------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+----------+------+---------------+---------+---------+------------------+--------+-------------+
| 1 | SIMPLE | customer | ALL | PRIMARY | NULL | NULL | NULL | 199786 | Using where |
| 1 | SIMPLE | orders | ref | cust_id | cust_id | 5 | customer.cust_id | 1 | |
+------+-------------+----------+------+---------------+---------+---------+------------------+--------+-------------+SHOW ANALYZE format=json FOR 3;
| {
"r_query_time_in_progress_ms": 32138,"query_block": {
"select_id": 1,
"r_loops": 1,
"nested_loop": [
{
"table": {
"table_name": "customer",
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"r_loops": 1,
"rows": 199786,
"r_rows": 110544,"filtered": 100,
"r_filtered": 9.538283398,
"attached_condition": "customer.`status` = 'GOLD'"
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["cust_id"],
"key": "cust_id",
"key_length": "5",
"used_key_parts": ["cust_id"],
"ref": ["test.customer.cust_id"],
"r_loops": 10544,
"rows": 1,
"r_rows": 99.99222307,"filtered": 100,
"r_filtered": 100
}
}
]
}
}Connection 1> ANALYZE SELECT ... ;Connection 2> SHOW ANALYZE FORMAT=JSON FOR <connection_id>;
ANALYZE
{
"r_query_time_in_progress_ms": 30727,
"query_block": {
"select_id": 1,
"r_loops": 1,
"nested_loop": [
{
"table": {
"table_name": "customer",
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"r_loops": 1,
"rows": 199786,
"r_rows": 109994,
"r_table_time_ms": 232.699,
"r_other_time_ms": 46.355,"filtered": 100,
"r_filtered": 9.085950143,
"attached_condition": "customer.`status` = 'GOLD'"
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["cust_id"],
"key": "cust_id",
"key_length": "5",
"used_key_parts": ["cust_id"],
"ref": ["test.customer.cust_id"],
"r_loops": 9994,
"rows": 1,
"r_rows": 99.99779868,
"r_table_time_ms": 29460.609,
"r_other_time_ms": 986.842,"filtered": 100,
"r_filtered": 100
}
}
]
}
}View the status of replication threads. This statement displays critical metrics like log positions and error status for the replica.
or
This statement is to be run on a replica and provides status information on essential parameters of the threads.
This statement requires the privilege.
This statement requires the privilege.
This statement requires the privilege.
The ALL and "connection_name" options allow you to connect to .
ALL REPLICAS gives you a list of all connections to the primary nodes.
ALL SLAVES gives you a list of all connections to the primary nodes.
The rows are sorted according to Connection_name.
If you specify a connection_name, you only get the information about that connection. If connection_name is not used, then the name set by default_master_connection is used. If the connection name doesn't exist you will get an error:There is no master connection for 'xxx'.
MariaDB starting with
The FOR CHANNEL keyword was added for MySQL compatibility. This is identical to using the channel_name directly after SHOW SLAVE.
The order in which the columns appear depends on the MariaDB version. This means that extracting a column value is best done by comparing the field name instead of using a fixed offset into the row.
These columns can also be viewed/extracted from the table.
These columns cannot be viewed/extracted from the table.
Connection_name: Name of the primary connection. Returned with SHOW ALL REPLICAS STATUS only.
Slave_SQL_State: State of SQL thread. Returned with SHOW ALL REPLICAS STATUSonly. See . Slave_IO_State: State of I/O thread. See .
Connection_name: Name of the primary connection. Returned with SHOW ALL SLAVES STATUS only.
Slave_SQL_State: State of SQL thread. Returned with SHOW ALL SLAVES STATUS only. See . Slave_IO_State: State of I/O thread. See .
Master_host: Master host that the replica is connected to.
Master_user: Account user name being used to connect to the primary.
Master_port: The port being used to connect to the primary.
Connect_Retry: Time in seconds between retries to connect. The default is 60. The statement can set this. The option determines the maximum number of reconnection attempts.
Master_Log_File: Name of the primary file that the I/O thread is currently reading from.
Read_Master_Log_Pos: Position up to which the I/O thread has read in the current primary file.
Relay_Log_File: Name of the relay log file that the SQL thread is currently processing.
Relay_Log_Pos: Position up to which the SQL thread has finished processing in the current relay log file.
Relay_Master_Log_File: Name of the primary file that contains the most recent event executed by the SQL thread.
Slave_IO_Running: Whether the replica I/O thread is running and connected (Yes), running but not connected to a primary (Connecting) or not running (No).
Slave_SQL_Running: Whether or not the SQL thread is running.
Replicate_Do_DB: Databases specified for replicating with the option.
Replicate_Ignore_DB: Databases specified for ignoring with the option.
Replicate_Do_Table: Tables specified for replicating with the option.
Replicate_Ignore_Table: Tables specified for ignoring with the option.
Replicate_Wild_Do_Table: Tables specified for replicating with the option.
Replicate_Wild_Ignore_Table: Tables specified for ignoring with the option.
Last_Errno: Alias for Last_SQL_Errno (see below)
Last_Error: Alias for Last_SQL_Error (see below)
Skip_Counter: Number of events that a replica skips from the master, as recorded in the system variable.
Exec_Master_Log_Pos: Position up to which the SQL thread has processed in the current master file. Can be used to start a new replica from a current replica with the option.
Relay_Log_Space: Total size of all relay log files combined.
Until_Condition: One of four possible values: None, Master, Relay, or Gtid, depending on the respective condition.
Until_Log_File: The MASTER_LOG_FILE value of the condition.
Until_Log_Pos: The MASTER_LOG_POS value of the condition.
Master_SSL_Allowed: Whether an SSL connection is permitted (Yes), not permitted (No) or permitted but without the replica having SSL support enabled (Ignored)
Master_SSL_CA_File: The MASTER_SSL_CA option of the statement.
Master_SSL_CA_Path: The MASTER_SSL_CAPATH option of the statement.
Master_SSL_Cert: The MASTER_SSL_CERT option of the statement.
Master_SSL_Cipher: The MASTER_SSL_CIPHER option of the statement.
Master_SSL_Key: The MASTER_SSL_KEY option of the statement.
Seconds_Behind_Master: Difference between the timestamp logged on the master for the event that the replica is currently processing, and the current timestamp on the replica. Zero if the replica is not currently processing an event. With serial replication, seconds_behind_master is updated when the SQL thread begins executing a transaction. With , seconds_behind_master is updated only after transactions commit. An exception is thrown on the parallel replica to additionally update seconds_behind_master when the first transaction received after idling is queued to a worker for execution, to provide a reliable initial value for the duration until a transaction commits.
Additional behavior to be aware of:
Seconds_Behind_Master will update for ignored events, e.g. those skipped due to .
Master_SSL_Verify_Server_Cert: The MASTER_SSL_VERIFY_SERVER_CERT option of the statement.
Last_IO_Errno: Error code of the most recent error that caused the I/O thread to stop (also recorded in the replica's error log). 0 means no error. or will reset this value.
Last_IO_Error: Error message of the most recent error that caused the I/O thread to stop (also recorded in the replica's error log). An empty string means no error. or will reset this value.
Last_SQL_Errno: Error code of the most recent error that caused the SQL thread to stop (also recorded in the replica's error log). 0 means no error. or will reset this value.
Last_SQL_Error: Error message of the most recent error that caused the SQL thread to stop (also recorded in the replica's error log). An empty string means no error. or will reset this value.
Replicate_Ignore_Server_Ids: List of that are currently being ignored for replication purposes, or an empty string for none, as specified in the IGNORE_SERVER_IDS option of the statement.
Master_Server_Id: The master's value.
Master_SSL_Crl: The MASTER_SSL_CRL option of the statement.
Master_SSL_Crlpath: The MASTER_SSL_CRLPATH option of the statement.
Using_Gtid: Whether or not are being used for replication (can be No, Slave_Pos, or Current_Pos).
Gtid_IO_Pos: Current value.
Replicate_Do_Domain_Ids: List of that are currently being recognized for replication purposes, or an empty string for none, as specified in the DO_DOMAIN_IDS option of the statement.
Replicate_Ignore_Domain_Ids: List of that are currently being ignored for replication purposes, or an empty string for none, as specified in the IGNORE_DOMAIN_IDS option of the statement.
Parallel_Mode: The as configured by the system variable.
SQL_Delay: Value specified by MASTER_DELAY in (or 0 if none).
SQL_Remaining_Delay: When the replica is delaying the execution of an event due to MASTER_DELAY, this is the number of seconds of delay remaining before the event will be applied. Otherwise, the value is NULL.
Slave_SQL_Running_State: The state of the SQL driver threads, same as in . When the replica is delaying the execution of an event due to MASTER_DELAY, this field displays: "Waiting until MASTER_DELAY seconds after master executed event".
Slave_DDL_Groups: This status variable counts the occurrence of DDL statements. This is a replica-side counter for optimistic parallel replication.
Slave_Non_Transactional_Groups: This status variable counts the occurrence of non-transactional event groups. This is a replica-side counter for optimistic parallel replication.
Slave_Transactional_Groups: This status variable counts the occurrence of transactional event groups. This is a replica-side counter for optimistic parallel replication.
Replicate_Rewrite_DB: Databases specified for replicating and with the system variable/option.
Replica_Rewrite_DB is not available.
Retried_transactions: The number of times that replicating transactions have been retried due to temporary errors (e.g. deadlocks in parallel replication). Returned with SHOW ALL SLAVES STATUS only.
Max_relay_log_size: Max size for this connection. Returned with SHOW ALL SLAVES STATUS only.
Executed_log_entries: Number of binary log events that have been executed, irrespective of error outcome (i.e. if the event execution results in an error, this number will still increase). Returned with SHOW ALL SLAVES STATUS only.
Slave_received_heartbeats: Number of that the slave has received. Note this counter does not reset when the slave is restarted; only when a new command has executed. Returned with SHOW ALL SLAVES STATUS only.
Slave_heartbeat_period: Configured (by ) interval in seconds between replication heartbeats. Returned with SHOW ALL SLAVES STATUS only.
Gtid_Slave_Pos: The value of the global variable , i.e. the GTID of the last event group replicated on a replica server, for each replication domain, as stored in the system variable. Returned with SHOW ALL SLAVES STATUS only.
Master_last_event_time: Timestamp of the last event read from the primary by the IO thread. NULL until the replica has started and the replica has read one query event from the primary that changes data.
Slave_last_event_time: Primary timestamp of the last event committed on the replica. NULL until the replica has started and the replica has read one query event from the primary that changes data.
Master_Slave_time_diff: The difference of the above two timestamps. NULL until the replica has started and the replica has read one query event from the primary that changes data.
Master_last_event_time, Slave_last_event_time, and Master_Slave_time_diff are not available.
Connects_Tried: The number of attempts done to connect to the primary. It starts from 0 with (but not ), or , and increments after each connection attempt until one succeeds or, after this reaches Master_Retry_Count, aborts the connection.
Master_Retry_Count: The limit to Connects_Tried as configured by .
Connects_Tried: and Master_Retry_Count: are not available. If the Performance Schema is enabled, has CONNECTION_RETRY_COUNT available as an older alternative to Master_Retry_Count.
If you issue this statement using the client, you can use a \G statement terminator rather than a semicolon to obtain a more readable vertical layout.
You can also access some of the variables directly from status variables:
This page is licensed: GPLv2, originally from
SHOW { REPLICA | SLAVE} ["connection_name"] STATUS [FOR CHANNEL "connection_name"]SHOW ALL { REPLICAS | SLAVES } STATUSSeconds_Behind_MasterWhen configured with MASTER_DELAY, as a replicated transaction begins executing (i.e. on a serial or post-idle parallel replica), Seconds_Behind_Master will update before delaying, and while delaying occurs will grow to encompass the configured value.
There is a known issue, tracked by MDEV-17516, such that Seconds_Behind_Master will initially present as 0 on replica restart until a replicated transaction begins executing, even if the last replica session was lagging behind when stopped.
Seconds_Behind_Master: Difference between the timestamp logged on the master for the event that the replica is currently processing, and the current timestamp on the replica. Zero if the replica is not currently processing an event. With serial replication, seconds_behind_master is updated when the SQL thread begins executing a transaction. With parallel replication, seconds_behind_master is updated only after transactions commit.
Additional behavior to be aware of:
Seconds_Behind_Master will update for ignored events, e.g. those skipped due to sql_slave_skip_counter.
On the serial replica, transactions with prior timestamps can update Seconds_Behind_Master such that it can go backwards, though this is not true for the parallel replica.
When configured with , as a replicated transaction begins executing (i.e. on a serial or post-idle parallel replica), Seconds_Behind_Master will update before delaying, and while delaying occurs will grow to encompass the configured value.
There is a known issue, tracked by , such that Seconds_Behind_Master will initially present as 0 on replica restart until a replicated transaction begins executing, even if the last replica session was lagging behind when stopped.
SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: db01.example.com
Master_User: replicant
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000021
Read_Master_Log_Pos: 17315
Relay_Log_File: relay-bin.000042
Relay_Log_Pos: 17446
Relay_Master_Log_File: mariadb-bin.000021
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 17146
Relay_Log_Space: 17972
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 6
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: Slave_Pos
Gtid_IO_Pos: 0-1-2042
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Updating
Slave_DDL_Groups: 1
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 2041
Replicate_Rewrite_DB:SHOW ALL SLAVES STATUS\G
*************************** 1. row ***************************
Connection_name:
Slave_SQL_State: Updating
Slave_IO_State: Waiting for master to send event
Master_Host: db01.example.com
Master_User: replicant
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000021
Read_Master_Log_Pos: 17315
Relay_Log_File: relay-bin.000042
Relay_Log_Pos: 17446
Relay_Master_Log_File: mariadb-bin.000021
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 17146
Relay_Log_Space: 17972
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 6
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: Slave_Pos
Gtid_IO_Pos: 0-1-2042
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Updating
Slave_DDL_Groups: 1
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 2041
Replicate_Rewrite_DB:
Retried_transactions: 0
Max_relay_log_size: 1073741824
Executed_log_entries: 6330
Slave_received_heartbeats: 0
Slave_heartbeat_period: 60.000
Gtid_Slave_Pos: 0-1-2041
Master_last_event_time: 2024-12-12 06:53:52
Slave_last_event_time: 2024-12-12 06:53:50
Master_Slave_time_diff: 2SET @@default_master_connection="test" ;
SHOW status like "%slave%"
Variable_name Value
Com_show_slave_hosts 0
Com_show_slave_status 0
Com_start_all_slaves 0
Com_start_slave 0
Com_stop_all_slaves 0
Com_stop_slave 0
Rpl_semi_sync_slave_status OFF
Slave_connections 0
Slave_heartbeat_period 1800.000
Slave_open_temp_tables 0
Slave_received_heartbeats 0
Slave_retried_transactions 0
Slave_running OFF
Slaves_connected 0
Slaves_running 1