-- Copyright (c) 2003, 2008-2012, Oracle and/or its affiliates. All rights reserved.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-- DO NOT EDIT THIS FILE. It is generated automatically.

-- To use this file, load its contents into the mysql database. For example,
-- with the mysql client program, process the file like this, where
-- file_name is the name of this file:

--     mysql -u root -p mysql < file_name

set names 'utf8';

set sql_log_bin = 0;

use mysql;
delete from help_topic;
delete from help_category;
delete from help_keyword;
delete from help_relation;

insert into help_category (help_category_id,name,parent_category_id,url) values (1,'Geographic',0,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (2,'Polygon properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (3,'WKT',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (4,'Numeric Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (5,'Plugins',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (6,'MBR',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (7,'Control flow functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (8,'Transactions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (9,'Help Metadata',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (10,'Account Management',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (11,'Point properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (12,'Encryption Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (13,'LineString properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (14,'Miscellaneous Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (15,'Logical operators',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (16,'Functions and Modifiers for Use with GROUP BY',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (17,'Information Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (18,'Comparison operators',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (19,'Bit Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (20,'Table Maintenance',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (21,'User-Defined Functions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (22,'Data Types',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (23,'Compound Statements',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (24,'Geometry constructors',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (25,'GeometryCollection properties',1,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (26,'Administration',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (27,'Data Manipulation',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (28,'Utility',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (29,'Language Structure',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (30,'Geometry relations',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (31,'Date and Time Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (32,'WKB',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (33,'Procedures',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (34,'Geographic Features',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (35,'Contents',0,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (36,'Geometry properties',34,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (37,'String Functions',38,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (38,'Functions',35,'');
insert into help_category (help_category_id,name,parent_category_id,url) values (39,'Data Definition',35,'');

INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (0, 22, 'AUTO\\_INCREMENT FAQ', 'Description\n-----------\n\nHow do I get the last inserted auto_increment value?\n\nUse the LAST_INSERT_ID() function:\n\n``sql\nSELECT LAST_INSERT_ID();\n`\n\nWhat if someone else inserts before I select my id?\n\nLAST_INSERT_ID() is connection specific, so there is no problem from race conditions.\n\nHow do I get the next value to be inserted?\n\nYou don''t. Insert, then find out what you did with LAST_INSERT_ID().\n\nHow do I change what number auto_increment starts with?\n\nRun a query, ALTER TABLE yourTable AUTO_INCREMENT = x; . The next insert will contain x or MAX(autoField) + 1, whichever is higher.\n\nAs an alternative, run INSERT INTO yourTable (autoField) VALUES (x); . The next insert will contain x+1 or MAX(autoField) + 1, whichever is higher.\n\nIssuing TRUNCATE TABLE will delete all the rows in the table, and will reset the auto_increment value to 0 in most cases.\n\nHow do I renumber rows once I deleted some in the middle?\n\nTypically, you don''t want to. Gaps are hardly ever a problem; if your application can''t handle gaps in the sequence, you probably should rethink your application.\n\nCan I do group-wise auto_increment?\n\nYes, if you use the MyISAM engine.\n\nHow do I get the AUTO_INCREMENT value in a BEFORE INSERT trigger?\n\nThis isn''t possible. It''s only available after insert.\n\nHow do I assign two fields the same auto_increment value in one query?\n\nYou can''t, not even with an AFTER INSERT trigger. Insert, then go back and update using LAST_INSERT_ID(). Those two statements could be wrapped into one stored procedure if you wish.\n\nHowever, you can mimic this behavior with a BEFORE INSERT trigger and a second table to store the sequence position:\n\n`sql\nCREATE TABLE sequence (table_name VARCHAR(255), position INT UNSIGNED);\nINSERT INTO sequence VALUES (''testTable'', 0);\nCREATE TABLE testTable (firstAuto INT UNSIGNED, secondAuto INT UNSIGNED);\nDELIMITER //\nCREATE TRIGGER testTable_BI BEFORE INSERT ON testTable FOR EACH ROW BEGIN\n  UPDATE sequence SET position = LAST_INSERT_ID(position + 1) WHERE table_name = ''testTable'';\n  SET NEW.firstAuto = LAST_INSERT_ID();\n  SET NEW.secondAuto = LAST_INSERT_ID();\nEND//\nDELIMITER ;\nINSERT INTO testTable VALUES (NULL, NULL), (NULL, NULL);\nSELECT  FROM testTable;\n\n+-----------+------------+\n| firstAuto | secondAuto |\n+-----------+------------+\n|         1 |          1 |\n|         2 |          2 |\n+-----------+------------+\n`\n\nThe same sequence table can maintain separate sequences for multiple tables (or separate sequences for different fields in the same table) by adding extra rows.\n\nDoes the auto_increment field have to be primary key?\n\nNo, it only has to be indexed. It doesn''t even have to be unique.\n\nHow does InnoDB handle AUTO_INCREMENT?\n\nSee AUTO_INCREMENT handling in InnoDB.\n\nGeneral Information To Read\n\nAUTO_INCREMENT\n\nManual Notes\n\nThere can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot have a DEFAULT value. An AUTO_INCREMENT column works properly only if it contains only positive values. Inserting a negative number is regarded as inserting a very large positive number. This is done to avoid precision problems when numbers wrap over from positive to negative and also to ensure that you do not accidentally get an AUTO_INCREMENT column that contains 0.\n\nHow to start a table with a set AUTO_INCREMENT value?\n\n`sql\nCREATE TABLE autoinc_test (\n  h INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, \n  m INT UNSIGNED \n) AUTO_INCREMENT = 100;\n\nINSERT INTO autoinc_test ( m ) VALUES ( 1 );\n\nSELECT  FROM autoinc_test;\n+-----+------+\n| h   | m    |\n+-----+------+\n| 100 |    1 |\n+-----+------+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/auto_increment-faq', '', 'https://mariadb.com/docs/server/reference/data-types/auto_increment-faq');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (1, 22, 'AUTO\\_INCREMENT', 'Description\n-----------\n\nThe AUTO_INCREMENT attribute can be used to generate a unique identity for new rows. When you insert a new record into the table (or upon adding an AUTO_INCREMENT attribute with the ALTER TABLE statement), and the AUTO_INCREMENT field is NULL or DEFAULT (in the case of an INSERT), automatically be incremented. This also applies to 0, unless the NO_AUTO_VALUE_ON_ZERO SQL_MODE is enabled.\n\nAUTO_INCREMENT columns start from 1 by default. The automatically generated value can never be lower than 0.\n\nEach table can have only one AUTO_INCREMENT column. It must defined as a key (not necessarily the PRIMARY KEY or UNIQUE key). In some storage engines (including the default InnoDB), if the key consists of multiple columns, the AUTO_INCREMENT column must be the first column. Storage engines that permit the column to be placed elsewhere are Aria, MyISAM, MERGE, Spider, TokuDB, BLACKHOLE, FederatedX and Federated.\n\n``sql\nCREATE TABLE animals (\n     id MEDIUMINT NOT NULL AUTO_INCREMENT,\n     name CHAR(30) NOT NULL,\n     PRIMARY KEY (id)\n );\n\nINSERT INTO animals (name) VALUES\n    (''dog''),(''cat''),(''penguin''),\n    (''fox''),(''whale''),(''ostrich'');\n`\n\n`sql\nSELECT  FROM animals;\n+----+---------+\n| id | name    |\n+----+---------+\n|  1 | dog     |\n|  2 | cat     |\n|  3 | penguin |\n|  4 | fox     |\n|  5 | whale   |\n|  6 | ostrich |\n+----+---------+\n`\n\nSERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\n`sql\nCREATE TABLE t (id SERIAL, c CHAR(1)) ENGINE=InnoDB;\n\nSHOW CREATE TABLE t \\G\n*********************** 1. row ***********************\n       Table: t\nCreate Table: CREATE TABLE t (\n  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  c char(1) DEFAULT NULL,\n  UNIQUE KEY id (id)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n`\n\nSetting or Changing the Auto_Increment Value\n\nYou can use an ALTER TABLE statement to assign a new value to the auto_increment table option, or set the insert_id server system variable to change the next AUTO_INCREMENT value inserted by the current session.\n\nLAST_INSERT_ID() can be used to see the last AUTO_INCREMENT value inserted by the current session.\n\n`sql\nALTER TABLE animals AUTO_INCREMENT=8;\n\nINSERT INTO animals (name) VALUES (''aardvark'');\n\nSELECT  FROM animals;\n+----+-----------+\n| id | name      |\n+----+-----------+\n|  1 | dog       |\n|  2 | cat       |\n|  3 | penguin   |\n|  4 | fox       |\n|  5 | whale     |\n|  6 | ostrich   |\n|  8 | aardvark  |\n+----+-----------+\n\nSET insert_id=12;\n\nINSERT INTO animals (name) VALUES (''gorilla'');\n\nSELECT  FROM animals;\n+----+-----------+\n| id | name      |\n+----+-----------+\n|  1 | dog       |\n|  2 | cat       |\n|  3 | penguin   |\n|  4 | fox       |\n|  5 | whale     |\n|  6 | ostrich   |\n|  8 | aardvark  |\n| 12 | gorilla   |\n+----+-----------+\n`\n\nInnoDB\n\nAUTO_INCREMENT is persistent in InnoDB.\n\nSee also AUTO_INCREMENT Handling in InnoDB.\n\nSetting Explicit Values\n\nIt is possible to specify a value for an AUTO_INCREMENT column. If the key is primary or unique, the value must not already exist in the key.\n\nIf the new value is higher than the current maximum value, the AUTO_INCREMENT value is updated, so the next value will be higher. If the new value is lower than the current maximum value, the AUTO_INCREMENT value remains unchanged.\n\nThe following example demonstrates these behaviors:\n\n`sql\nCREATE TABLE t (id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE = InnoDB;\n\nINSERT INTO t VALUES (NULL);\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n+----+\n\nINSERT INTO t VALUES (10); -- higher value\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n| 10 |\n+----+\n\nINSERT INTO t VALUES (2); -- lower value\nINSERT INTO t VALUES (NULL); -- auto value\nSELECT id FROM t;\n+----+\n| id |\n+----+\n|  1 |\n|  2 |\n| 10 |\n| 11 |\n+----+\n`\n\nThe ARCHIVE storage engine does not allow to insert a value that is lower than the current maximum.\n\nMissing Values\n\nAn AUTO_INCREMENT column normally has missing values. This happens because if a row is deleted, or an AUTO_INCREMENT value is explicitly updated, old values are never re-used. The REPLACE statement also deletes a row, and its value is wasted. With InnoDB, values can be reserved by a transaction; but if the transaction fails (for example, because of a ROLLBACK) the reserved value will be lost.\n\nThus AUTO_INCREMENT values can be used to sort results in a chronological order, but not to create a numeric sequence.\n\nReplication\n\nTo make master-master or Galera safe to use AUTO_INCREMENT , you should use the system variables auto_increment_increment and auto_increment_offset to generate unique values for each server.\n\n`sql\nSET @@auto_increment_increment=3;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 1     |\n+--------------------------+-------+\n\nCREATE TABLE t (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nINSERT INTO t VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t;\n+---+\n| c |\n+---+\n| 1 |\n| 4 |\n| 7 |\n+---+\n\nCREATE TABLE t2 (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nSET @@auto_increment_offset=2;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 2     |\n+--------------------------+-------+\n\nINSERT INTO t2 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t2;\n+---+\n| c |\n+---+\n| 2 |\n| 5 |\n| 8 |\n+---+\n`\n\nIf auto_increment_offset is larger than auto_increment_increment, the value of auto_increment_offset is ignored, and the offset reverts to the default of 1 instead:\n\n`sql\nSET @@auto_increment_offset=5;\n\nSHOW VARIABLES LIKE ''auto_inc%'';\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 5     |\n+--------------------------+-------+\n\nCREATE TABLE t3 (c INT NOT NULL AUTO_INCREMENT PRIMARY KEY);\n\nINSERT INTO t3 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t3;\n+---+\n| c |\n+---+\n| 1 |\n| 4 |\n| 5 |\n+---+\n\n+--------------------------+-------+\n| Variable_name            | Value |\n+--------------------------+-------+\n| auto_increment_increment | 3     |\n| auto_increment_offset    | 3     |\n+--------------------------+-------+\n\nINSERT INTO t4 VALUES (NULL), (NULL), (NULL);\n\nSELECT  FROM t4;\n+---+\n| c |\n+---+\n| 3 |\n| 6 |\n| 9 |\n+---+\n`\n\nChanging auto_increment_increment and auto_incremenet_offset when adding a new master to a multi-master setup\n\nThe purpose of auto_increment_increment and auto_increment_offset is to ensure that in a multi-master or multi-source setup, all masters generate unique values for auto_increment fields or for sequences with INCREMENT=0.\n\nIf auto_increment_increment is larger than the current number of masters, then one can configure the new master with the not used auto_increment_offset. The easiest way to add a new master is to stop all MariaDB servers, update auto_increment_increment and auto_increment_offset in the configuration files, and restart.\\\\\n\nThis has to be done if auto_increment_increment is 1. If one has more than one master (auto_increment_increment > 1), there is a way to add more masters with only having to restart one of the masters. The ''trick'' is to configure one of the masters to not use all the values in its current sequence.\n\nThe following example illustrates how to do it. Assume you have two masters, A and B.\n\nIn this case you will have auto_increment_increment=2 for both masters and A would have auto_increment_offset=1 and B would have auto_increment_offset=2. For A, all auto_increment and generated sequence values will be odd.\n\n`sql\n1\n3\n5\n7\n`\n\nFor B, all values will be even:\n\n`sql\n2\n4\n6\n8\n`\n\nSee the Replication section above.\n\nIf we change auto_increment_increment from 2 to 4 in A, it will now generate values from this sequence:\n\n`sql\n1\n5\n9\n13\n`\n\nAs you can see, values 3, 7, 11 are not going to be used.We can get C to use values from this sequence by configuring auto_increment_increment=4 and auto_increment_offset=3.\n\n`sql\n3\n7\n11\n`\n\nIf we would like to add a 4''th master (D), we can do that by changing ''B'' to use auto_increment_increment=4 and then configure D to have auto_increment_increment=4 and auto_increment_offset=4.\n\nNote that when changing the auto_increment_increment or auto_increment_offset on a server, you have to either restart the server or ensure that all current connections are killed. This is needed to force all connections to use the new values.\n\nAlso ensure that, if you want to use the above trick, you always double the value of auto_increment_increment. This is needed to ensure that the sequence used will not conflict with numbers generated by any other master.\n\nCHECK Constraints, DEFAULT Values and Virtual Columns\n\nAUTO_INCREMENT columns are not permitted in CHECK constraints, DEFAULT value expressions and virtual columns.\n\nGenerating Auto_Increment Values When Adding the Attribute\n\n`sql\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (0),(0),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 1 |\n| 2 |\n| 3 |\n+---+\n`\n\n`sql\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (5),(0),(8),(0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 5 |\n| 6 |\n| 8 |\n| 9 |\n+---+\n`\n\nIf the NO_AUTO_VALUE_ON_ZERO SQL_MODE is set, zero values will not be automatically incremented:\n\n`sql\nSET SQL_MODE=''no_auto_value_on_zero'';\nCREATE OR REPLACE TABLE t1 (a INT);\nINSERT t1 VALUES (3), (0);\nALTER TABLE t1 MODIFY a INT NOT NULL AUTO_INCREMENT PRIMARY KEY;\nSELECT  FROM t1;\n+---+\n| a |\n+---+\n| 0 |\n| 3 |\n+---+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/auto_increment', '', 'https://mariadb.com/docs/server/reference/data-types/auto_increment');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (2, 22, 'Data Type Storage Requirements', 'Description\n-----------\n\nThe following tables indicate the approximate data storage requirements for each data type.\n\nNumeric Data Types\n\n| Data Type                                    | Storage Requirement                   |\n| -------------------------------------------- | ------------------------------------- |\n| TINYINT     | 1 byte                                |\n| SMALLINT   | 2 bytes                               |\n| MEDIUMINT | 3 bytes                               |\n| INT             | 4 bytes                               |\n| BIGINT       | 8 bytes                               |\n| FLOAT(p)      | 4 bytes if p <= 24, otherwise 8 bytes |\n| DOUBLE       | 8 bytes                               |\n| DECIMAL     | See table below                       |\n| BIT(M)          | (M+7)/8 bytes                         |\n\nNote that MEDIUMINT columns will require 4 bytes in memory (for example, in InnoDB buffer pool).\n\nDecimal\n\nDecimals are stored using a binary format, with the integer and the fraction stored separately. Each nine-digit multiple requires 4 bytes, followed by a number of bytes for whatever remains, as follows:\n\n| Remaining digits | Storage Requirement |\n| ---------------- | ------------------- |\n| 0                | 0 bytes             |\n| 1                | 1 byte              |\n| 2                | 1 byte              |\n| 3                | 2 bytes             |\n| 4                | 2 bytes             |\n| 5                | 3 bytes             |\n| 6                | 3 bytes             |\n| 7                | 4 bytes             |\n| 8                | 4 bytes             |\n\nString Data Types\n\nIn the descriptions below, M is the declared column length (in characters or in bytes), while len is the actual length in bytes of the value.\n\n| Data Type                                                                                    | Storage Requirement                                                                                        |\n| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |\n| ENUM                                                            | 1 byte for up to 255 enum values, 2 bytes for 256 to 65,535 enum values                                    |\n| CHAR(M)                                                         | M × w bytes, where w is the number of bytes required for the maximum-length character in the character set |\n| BINARY(M)                                                     | M bytes                                                                                                    |\n| VARCHAR(M), VARBINARY(M)   | len + 1 bytes if column is 0 – 255 bytes, len + 2 bytes if column may require more than 255 bytes          |\n| TINYBLOB, TINYTEXT         | len + 1 bytes                                                                                              |\n| BLOB, TEXT                         | len + 2 bytes                                                                                              |\n| MEDIUMBLOB, MEDIUMTEXT | len + 3 bytes                                                                                              |\n| LONGBLOB, LONGTEXT         | len + 4 bytes                                                                                              |\n| XMLTYPE                                                      | len + 4 bytes (same as LONGBLOB)                                                                           |\n| SET                                                    | Given M members of the set, (M+7)/8 bytes, rounded up to 1, 2, 3, 4, or 8 bytes                            |\n| INET6                                                          | 16 bytes                                                                                                   |\n| UUID                                                  | 16 bytes                                                                                                   |\n\nNote: Introduced in MariaDB 12.3, the XMLTYPE data type has a maximum storage capacity of 4GB, similar to LONGBLOB_._\n\nIn some character sets, not all characters use the same number of bytes. utf8 encodes characters with one to three bytes per character, while utf8mb4 requires one to four bytes per character.\n\nWhen using field the COMPRESSED attribute, 1 byte is reserved for metadata. For example, VARCHAR(255) will use +2 bytes instead of +1.\n\nURL: https://mariadb.com/docs/server/reference/data-types/data-type-storage-requirements', '', 'https://mariadb.com/docs/server/reference/data-types/data-type-storage-requirements');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (3, 22, 'DATE', 'Syntax\n------\n\nDATE\n\nDescription\n-----------\n\nA date. The supported range is ''1000-01-01'' to ''9999-12-31''. MariaDB displays DATE values in ''YYYY-MM-DD'' format, but can be assigned dates in looser formats, including strings or numbers, as long as they make sense. These include a short year, YY-MM-DD, no delimiters, YYMMDD, or any other acceptable delimiter, for example YYYY/MM/DD. For details, see date and time literals.\n\n''0000-00-00'' is a permitted special value (zero-date), unless the NO_ZERO_DATE SQL_MODE is used. Also, individual components of a date can be set to 0 (for example: ''2015-00-12''), unless the NO_ZERO_IN_DATE SQL_MODE is used. In many cases, the result of en expression involving a zero-date, or a date with zero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range between 1 and 31, the date does not produce any error, even for months that have less than 31 days.\n\nOracle Mode\n\nIn Oracle mode, DATE with a time portion is a synonym for DATETIME. See also mariadb_schema.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATE);\n\nINSERT INTO t1 VALUES ("2010-01-12"), ("2011-2-28"), (''120314''),(''130421'');\n\nSELECT * FROM t1;\n+------------+\n| d          |\n+------------+\n| 2010-01-12 |\n| 2011-02-28 |\n| 2012-03-14 |\n| 2013-04-21 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/date', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/date');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (4, 22, 'DATETIME', 'Syntax\n------\n\nDATETIME [(microsecond precision)]\n\nDescription\n-----------\n\nA date and time combination.\n\nMariaDB displays DATETIME values in ''YYYY-MM-DD HH:MM:SS.ffffff'' format, but allows assignment of values to DATETIME columns using either strings or numbers. For details, see date and time literals.\n\nDATETIME columns also accept CURRENT_TIMESTAMP as the default value.\n\nThe --mysql56-temporal-format option, on by default, allows MariaDB to store DATETME values using the same low-level format MySQL 5.6 uses. For more information, see Internal Format, below.\n\nFor storage requirements, see Data Type Storage Requirements.\n\nSupported Values\n\nMariaDB stores values that use the DATETIME data type in a format that supports values between 1000-01-01 00:00:00.000000 and 9999-12-31 23:59:59.999999.\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no microsecond precision is specified, then 0 is used by default.\n\nMariaDB also supports ''0000-00-00'' as a special _zero-date_ value, unless NO_ZERO_DATE is specified in the SQL_MODE. Similarly, individual components of a date can be set to 0 (for example: ''2015-00-12''), unless NO_ZERO_IN_DATE is specified in the SQL_MODE. In many cases, the result of en expression involving a zero-date, or a date with zero-parts, is NULL. If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range between 1 and 31, the date does not produce any error, even for months that have less than 31 days.\n\nOracle Mode\n\nIn Oracle mode, DATE with a time portion is a synonym for DATETIME. See also mariadb_schema.\n\nInternal Format\n\nA new temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a DATETIME column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col DATETIME;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mysqldump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_datetime\\G\n************************ 1. row ***********************\n       Table: mariadb5312_datetime\nCreate Table: CREATE TABLE mariadb5312_datetime (\n  dt0 datetime / mariadb-5.3 / DEFAULT NULL,\n  dt6 datetime(6) / mariadb-5.3 / DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nExamples\n--------\n\nCREATE TABLE t1 (d DATETIME);\n\nINSERT INTO t1 VALUES ("2011-03-11"), ("2012-04-19 13:08:22"),\n ("2013-07-18 13:44:22.123456");\n\nSELECT  FROM t1;\n+---------------------+\n| d                   |\n+---------------------+\n| 2011-03-11 00:00:00 |\n| 2012-04-19 13:08:22 |\n| 2013-07-18 13:44:22 |\n+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/datetime', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/datetime');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (5, 22, 'SQL\\_TSI\\_YEAR', 'Description\n-----------\n\nSee YEAR.\n\nExamples\n--------\n\nCREATE TABLE sql_tsi_year_example (\n  example SQL_TSI_YEAR\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/sql_tsi_year', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/sql_tsi_year');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (6, 22, 'TIME', 'Syntax\n------\n\nTIME [(<microsecond precision>)]\n\nDescription\n-----------\n\nA time. The range is ''-838:59:59.999999'' to ''838:59:59.999999''. Microsecond precision can be from 0-6; if not specified 0 is used.\n\nMariaDB displays TIME values in ''HH:MM:SS.ssssss'' format, but allows assignment of times in looser formats, including ''D HH:MM:SS'', ''HH:MM:SS'', ''HH:MM'', ''D HH:MM'', ''D HH'', ''SS'', or ''HHMMSS'', as well as permitting dropping of any leading zeros when a delimiter is provided, for example ''3:9:10''. For details, see date and time literals.\n\nThe --mysql56-temporal-format option, on by default, allows MariaDB to store TIME values using the same low-level format MySQL 5.6 uses.\n\nInternal Format\n\nA new temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIME column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIME;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mariadb-dump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_time\\G\n************************ 1. row ***********************\n       Table: mariadb5312_time\nCreate Table: CREATE TABLE mariadb5312_time (\n  t0 time / mariadb-5.3 / DEFAULT NULL,\n  t6 time(6) / mariadb-5.3 / DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nColumns with the current format are not marked with a comment.\n\nExamples\n--------\n\nINSERT INTO time VALUES (''90:00:00''), (''800:00:00''), (800), (22), (151413), (''9:6:3''), (''12 09'');\n\nSELECT  FROM time;\n+-----------+\n| t         |\n+-----------+\n| 90:00:00  |\n| 800:00:00 |\n| 00:08:00  |\n| 00:00:22  |\n| 15:14:13  |\n| 09:06:03  |\n| 297:00:00 |\n+-----------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/time', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (7, 22, 'TIMESTAMP', 'Syntax\n------\n\nTIMESTAMP [(<microsecond precision)]\n\nDescription\n-----------\n\nA timestamp in the format YYYY-MM-DD HH:MM:SS.ffffff.\n\nThe timestamp field is generally used to define at which moment in time a row was added or updated and by default will automatically be assigned the current datetime when a record is inserted or updated. The automatic properties only apply to the first TIMESTAMP in the record; subsequent TIMESTAMP columns will not be changed.\n\nMariaDB includes the --mysql56-temporal-format option, on by default, which allows MariaDB to store TIMESTAMP values using the same low-level format MySQL 5.6 uses.\n\nFor more information, see Internal Format.\n\nSupported Values\n\nMariaDB stores values that use the TIMESTAMP data type as the number of seconds since ''1970-01-01 00:00:00'' (UTC). This means that the TIMESTAMP data type can hold values between ''1970-01-01 00:00:01'' (UTC) and ''2106-02-07 06:28:15 UTC''.\n\nMariaDB stores values that use the TIMESTAMP data type as the number of seconds since ''1970-01-01 00:00:00'' (UTC). This means that the TIMESTAMP data type can hold values between ''1970-01-01 00:00:01'' (UTC) and ''2038-01-19 03:14:07'' (UTC).\n\nMariaDB can also store microseconds with a precision between 0 and 6. If no microsecond precision is specified, then 0 is used by default.\n\nAutomatic Values\n\nMariaDB has special behavior for the first column that uses the TIMESTAMP data type in a specific table when the system variable explicit_defaults_for_timestamp is not set (which was the default until MariaDB 10.10). For the first column that uses the TIMESTAMP data type in a specific table, MariaDB automatically assigns the following properties to the column:\n\n DEFAULT CURRENT_TIMESTAMP\n ON UPDATE CURRENT_TIMESTAMP\n\nThis means that if the column is not explicitly assigned a value in an INSERT or UPDATE query, then MariaDB will automatically initialize the column''s value with the current date and time.\n\nThis automatic initialization for INSERT and UPDATE queries can also be explicitly enabled for a column that uses the TIMESTAMP data type by specifying the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses for the column. In these clauses, any synonym of CURRENT_TIMESTAMP is accepted, including CURRENT_TIMESTAMP(), NOW(), LOCALTIME, LOCALTIME(), LOCALTIMESTAMP, and LOCALTIMESTAMP().\n\nThis automatic initialization for INSERT queries can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying a constant DEFAULT value. For example, DEFAULT 0.\n\nThis automatic initialization for UPDATE queries can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying a DEFAULT clause for the column, but no ON UPDATE clause. If a DEFAULT clause is explicitly specified for a column that uses the TIMESTAMP data type, but an ON UPDATE clause is not specified for the column, then the timestamp value will not automatically change when an UPDATE statement is executed.\n\nMariaDB also has special behavior if NULL is assigned to column that uses the TIMESTAMP data type. If the column is assigned the NULL value in an INSERT or UPDATE query, then MariaDB will automatically initialize the column''s value with the current date and time. For details, see NULL values in MariaDB.\n\nThis automatic initialization for NULL values can also be explicitly disabled for a column that uses the TIMESTAMP data type by specifying the NULL attribute for the column. In this case, if the column''s value is set to NULL, then the column''s value will actually be set to NULL.\n\nTime Zones\n\nIf a column uses the TIMESTAMP data type, then any inserted values are converted from the session''s time zone to Coordinated Universal Time (UTC) when stored, and converted back to the session''s time zone when retrieved.\n\nMariaDB validates TIMESTAMP literals against the session''s time zone. For example, if a specific time range never occurred in a specific time zone due to daylight savings time, then TIMESTAMP values within that range would be invalid for that time zone.\n\nMariaDB does not store any time zone identifier with the value of the TIMESTAMP data type. See MDEV-10018 for more information.\n\nMariaDB does not support time zone literals that contain time zone identifiers. See MDEV-11829 for more information.\n\nLimitations\n\n Because the TIMESTAMP value is stored as Epoch Seconds, the timestamp value ''1970-01-01 00:00:00'' (UTC) is reserved since the second #0 is used to represent ''0000-00-00 00:00:00''.\n\nSQL_MODE=MAXDB\n\nIf the SQL_MODE is set to MAXDB, TIMESTAMP fields will be silently converted to DATETIME.\n\nInternal Format\n\nA temporal format was introduced from MySQL 5.6 that alters how the TIME, DATETIME and TIMESTAMP columns operate at lower levels. These changes allow these temporal data types to have fractional parts and negative values. You can disable this feature using the mysql56_temporal_format system variable.\n\nTables that include TIMESTAMP values that were created on an older version of MariaDB or that were created while the mysql56_temporal_format system variable was disabled continue to store data using the older data type format.\n\nIn order to update table columns from the older format to the newer format, execute an ALTER TABLE... MODIFY COLUMN statement that changes the column to the _same_ data type. This change may be needed if you want to export the table''s tablespace and import it onto a server that has mysql56_temporal_format=ON set (see MDEV-15225).\n\nFor instance, if you have a TIMESTAMP column in your table:\n\n``sql\nSHOW VARIABLES LIKE ''mysql56_temporal_format'';\n\n+-------------------------+-------+\n| Variable_name           | Value |\n+-------------------------+-------+\n| mysql56_temporal_format | ON    |\n+-------------------------+-------+\n\nALTER TABLE example_table MODIFY ts_col TIMESTAMP;\n`\n\nWhen MariaDB executes the ALTER TABLE statement, it converts the data from the older temporal format to the newer one.\n\nIn the event that you have several tables and columns using temporal data types that you want to switch over to the new format, make sure the system variable is enabled, then perform a dump and restore using mariadb-dump. The columns using relevant temporal data types are restored using the new temporal format.\n\nColumns with old temporal formats are marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\nColumns with old temporal formats are not marked with a / mariadb-5.3 / comment in the output of SHOW CREATE TABLE, SHOW COLUMNS, DESCRIBE statements, as well as in the COLUMN_TYPE column of the INFORMATION_SCHEMA.COLUMNS Table.\n\n`sql\nSHOW CREATE TABLE mariadb5312_timestamp\\G\n*********************** 1. row ***********************\n       Table: mariadb5312_timestamp\nCreate Table: CREATE TABLE mariadb5312_timestamp (\n  ts0 timestamp / mariadb-5.3 / NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  ts6 timestamp(6) / mariadb-5.3 / NOT NULL DEFAULT ''0000-00-00 00:00:00.000000''\n) ENGINE=MyISAM DEFAULT CHARSET=latin1\n``\n\nExamples\n--------\n\nCREATE TABLE t (id INT, ts TIMESTAMP);\n\nDESC t;\n+-------+-----------+------+-----+-------------------+-----------------------------+\n| Field | Type      | Null | Key | Default           | Extra                       |\n+-------+-----------+------+-----+-------------------+-----------------------------+\n| id    | int(11)   | YES  |     | NULL              |                             |\n| ts    | timestamp | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |\n+-------+-----------+------+-----+-------------------+-----------------------------+\n\nINSERT INTO t(id)  VALUES (1),(2);\n\nSELECT  FROM t;\n+------+---------------------+\n| id   | ts                  |\n+------+---------------------+\n|    1 | 2013-07-22 12:50:05 |\n|    2 | 2013-07-22 12:50:05 |\n+------+---------------------+\n\nINSERT INTO t  VALUES (3,NULL),(4,''2001-07-22 12:12:12'');\n\nSELECT * FROM t;\n+------+---------------------+\n| id   | ts                  |\n+------+---------------------+\n|    1 | 2013-07-22 12:50:05 |\n|    2 | 2013-07-22 12:50:05 |\n|    3 | 2013-07-22 12:51:56 |\n|    4 | 2001-07-22 12:12:12 |\n+------+---------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/timestamp', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/timestamp');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (8, 22, 'YEAR Data Type', 'Syntax\n------\n\nYEAR[(4)]\n\nDescription\n-----------\n\nA year in four-digit format. The two-digit format, while supported, is error-prone and deprecated since 2012.\n\nIn four-digit format, the allowable values are 1901 to 2155, and 0000. In two-digit format, the allowable values are 70 to 69, representing years from 1970 to 2069. MariaDB displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers.\n\nInserting numeric zero has a different result for YEAR(4) and YEAR(2). For YEAR(2), the value 00 reflects the year 2000. For YEAR(4), the value 0000 reflects the year zero. This only applies to numeric zero. String zero always reflects the year 2000.\n\nExamples\n--------\n\nCREATE TABLE y(y YEAR);\n\nINSERT INTO y VALUES (1990),(''2012'');\n\nSELECT * FROM y;\n+------+\n| y    |\n+------+\n| 1990 |\n| 2012 |\n+------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/year-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/year-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (9, 22, 'NULL Values', 'Description\n-----------\n\nNULL represents an unknown value. It is _not_ an empty string (by default), or a zero value. These are all valid values, and are not NULL values.\n\nWhen a table is created or the format altered, columns can be specified as accepting NULL values, or not accepting them, with the NULL and NOT NULL clauses respectively.\n\nFor example, a customer table could contain dates of birth. For some customers, this information is unknown, so the value could be NULL.\n\nThe same system could allocate a customer ID for each customer record, and in this case a NULL value would not be permitted.\n\n``sql\nCREATE TABLE customer (\n id INT NOT NULL, \n date_of_birth DATE NULL\n...\n)\n`\n\nUser-defined variables are NULL until a value is explicitly assigned.\n\nStored routines parameters and local variables can always be set to NULL. If no DEFAULT value is specified for a local variable, its initial value will be NULL. If no value is assigned to an OUT parameter in a stored procedure, NULL is assigned at the end of the procedure.\n\nSyntax\n\nThe case of NULL is not relevant. (uppercase) is an alias for NULL.\n\nThe IS operator accepts UNKNOWN as an alias for NULL, which is meant for boolean contexts.\n\nComparison Operators\n\nNULL values cannot be used with most comparison operators. For example, =, >, >=, <=, <, or != cannot be used, as any comparison with a NULL always returns a NULL value, never true (1) or false (0).\n\n`sql\nSELECT NULL = NULL;\n+-------------+\n| NULL = NULL |\n+-------------+\n|        NULL |\n+-------------+\n\nSELECT 99 = NULL;\n+-----------+\n| 99 = NULL |\n+-----------+\n|      NULL |\n+-----------+\n`\n\nTo overcome this, certain operators are specifically designed for use with NULL values. To cater for testing equality between two values that may contain NULL values, there''s <=>, NULL-safe equal.\n\n`sql\nSELECT 99 <=> NULL, NULL <=> NULL;\n+-------------+---------------+\n| 99 <=> NULL | NULL <=> NULL |\n+-------------+---------------+\n|           0 |             1 |\n+-------------+---------------+\n`\n\nOther operators for working with NULL values include IS NULL and IS NOT NULL, ISNULL (for testing an expression) and COALESCE (for returning the first non-NULL parameter).\n\nOrdering\n\nWhen you order by a field that may contain NULL values, any NULL values are considered to have the lowest value. So ordering in DESC order will see the NULL values appearing last. To force NULL values to be regarded as highest values, one can add another column which has a higher value when the main field is NULL. Example:\n\n`sql\nSELECT col1 FROM tab ORDER BY ISNULL(col1), col1;\n`\n\nDescending order, with NULL values first:\n\n`sql\nSELECT col1 FROM tab ORDER BY IF(col1 IS NULL, 0, 1), col1 DESC;\n`\n\nAll NULL values are also regarded as equivalent for the purposes of the DISTINCT and GROUP BY clauses.\n\nFunctions\n\nIn most cases, functions will return NULL if any of the parameters are NULL. There are also functions specifically for handling NULL values. These include IFNULL(), NULLIF() and COALESCE().\n\n`sql\nSELECT IFNULL(1,0); \n+-------------+\n| IFNULL(1,0) |\n+-------------+\n|           1 |\n+-------------+\n\nSELECT IFNULL(NULL,10);\n+-----------------+\n| IFNULL(NULL,10) |\n+-----------------+\n|              10 |\n+-----------------+\n\nSELECT COALESCE(NULL,NULL,1);\n+-----------------------+\n| COALESCE(NULL,NULL,1) |\n+-----------------------+\n|                     1 |\n+-----------------------+\n`\n\nAggregate functions, such as SUM and AVG ignore NULL values.\n\n`sql\nCREATE TABLE t(x INT);\n\nINSERT INTO t VALUES (1),(9),(NULL);\n\nSELECT SUM(x) FROM t;\n+--------+\n| SUM(x) |\n+--------+\n|     10 |\n+--------+\n\nSELECT AVG(x) FROM t;\n+--------+\n| AVG(x) |\n+--------+\n| 5.0000 |\n+--------+\n`\n\nThe one exception is COUNT(\\), which counts rows, and doesn''t look at whether a value is NULL or not. Compare for example, COUNT(x), which ignores the NULL, and COUNT(), which counts it:\n\n`sql\nSELECT COUNT(x) FROM t;\n+----------+\n| COUNT(x) |\n+----------+\n|        2 |\n+----------+\n\nSELECT COUNT() FROM t;\n+----------+\n| COUNT() |\n+----------+\n|        3 |\n+----------+\n`\n\nAUTO_INCREMENT, TIMESTAMP and Virtual Columns\n\nMariaDB handles NULL values in a special way if the field is an AUTO_INCREMENT, a TIMESTAMP or a virtual column. Inserting a NULL value into a numeric AUTO_INCREMENT column will result in the next number in the auto increment sequence being inserted instead. This technique is frequently used with AUTO_INCREMENT fields, which are left to take care of themselves.\n\n`sql\nCREATE TABLE t2(id INT PRIMARY KEY AUTO_INCREMENT, letter CHAR(1));\n\nINSERT INTO t2(letter) VALUES (''a''),(''b'');\n\nSELECT  FROM t2;\n+----+--------+\n| id | letter |\n+----+--------+\n|  1 | a      |\n|  2 | b      |\n+----+--------+\n`\n\nSimilarly, if a NULL value is assigned to a TIMESTAMP field, the current date and time is assigned instead.\n\n`sql\nCREATE TABLE t3 (x INT, ts TIMESTAMP);\n\nINSERT INTO t3(x) VALUES (1),(2);\n`\n\nAfter a pause:\n\n`sql\nINSERT INTO t3(x) VALUES (3);\n\nSELECT FROM t3;\n+------+---------------------+\n| x    | ts                  |\n+------+---------------------+\n|    1 | 2013-09-05 10:14:18 |\n|    2 | 2013-09-05 10:14:18 |\n|    3 | 2013-09-05 10:14:29 |\n+------+---------------------+\n`\n\nIf a NULL is assigned to a VIRTUAL or PERSISTENT column, the default value is assigned instead.\n\n`sql\nCREATE TABLE virt (c INT, v INT AS (c+10) PERSISTENT) ENGINE=InnoDB;\n\nINSERT INTO virt VALUES (1, NULL);\n\nSELECT c, v FROM virt;\n+------+------+\n| c    | v    |\n+------+------+\n|    1 |   11 |\n+------+------+\n`\n\nIn all these special cases, NULL is equivalent to the DEFAULT keyword.\n\nInserting\n\nIf a NULL value is single-row inserted into a column declared as NOT NULL, an error will be returned. However, if the SQL mode is not strict (strict is the default), if a NULL value is multi-row inserted into a column declared as NOT NULL, the implicit default for the column type will be inserted (and NOT` the default value in the table definition). The implicit defaults are an empty string for string types, and the zero value for numeric, date and time types.\n\nBy default, both cases will result in an error.\n\nExamples\n--------\n\nCREATE TABLE nulltest (\n  a INT(11), \n  x VARCHAR(10) NOT NULL DEFAULT ''a'', \n  y INT(11) NOT NULL DEFAULT 23\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/null-values', '', 'https://mariadb.com/docs/server/reference/data-types/null-values');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (10, 22, 'BIGINT', 'Syntax\n------\n\nBIGINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA large integer. The signed range is -9223372036854775808 to9223372036854775807. The unsigned range is 0 to18446744073709551615.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so that the BIGINT value contains a number of M digits.\n\nNote: If the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nSERIAL is an alias for:\n\n``sql\nBIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE\n`\n\nINT8 is a synonym for BIGINT`.\n\nExamples\n--------\n\nCREATE TABLE bigints (a BIGINT,b BIGINT UNSIGNED,c BIGINT ZEROFILL);\n\nINSERT INTO bigints VALUES (-10,-10,-10);\nERROR 1264 (22003): Out of range value for column ''b'' at row 1\n\nINSERT INTO bigints VALUES (-10,10,-10);\nERROR 1264 (22003): Out of range value for column ''c'' at row 1\n\nINSERT INTO bigints VALUES (-10,10,10);\n\nINSERT INTO bigints VALUES (9223372036854775808,9223372036854775808,9223372036854775808);\nERROR 1264 (22003): Out of range value for column ''a'' at row 1\n\nINSERT INTO bigints VALUES (9223372036854775807,9223372036854775808,9223372036854775808);\n\nSELECT * FROM bigints;\n+---------------------+---------------------+----------------------+\n| a                   | b                   | c                    |\n+---------------------+---------------------+----------------------+\n|                 -10 |                  10 | 00000000000000000010 |\n| 9223372036854775807 | 9223372036854775808 | 09223372036854775808 |\n+---------------------+---------------------+----------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bigint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bigint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (11, 22, 'BIT', 'Syntax\n------\n\nBIT[(M)]\n\nDescription\n-----------\n\nA bit-field type. M indicates the number of bits per value, from 1 to64. The default is 1 if M is omitted.\n\nBit values can be inserted with b''value'' notation, where value is the bit value in 0''s and 1''s.\n\nBit fields are automatically zero-padded from the left to the full length of the bit, so for example in a BIT(4) field, ''10'' is equivalent to ''0010''.\n\nBits are returned as binary, so to display them, either add 0, or use a function such as HEX, OCT or BIN to convert them.\n\nExamples\n--------\n\nCREATE TABLE bit_example (\n  description VARCHAR(20),\n  b1 BIT,\n  b4 BIT(4),\n  b16 BIT(16)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bit', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bit');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (12, 22, 'BOOL', 'Description\n-----------\n\nSee TINYINT.\n\nExamples\n--------\n\nCREATE TABLE bool_example (\n  example BOOL\n) DEFAULT CHARSET=latin1;\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bool', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bool');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (13, 22, 'BOOLEAN', 'Syntax\n------\n\nBOOL, BOOLEAN\n\nDescription\n-----------\n\nThese types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.\n\nHowever, the values TRUE and FALSE are merely aliases for 1 and 0. See Boolean Literals, as well as the IS operator for testing values against a boolean.\n\nExamples\n--------\n\nCREATE TABLE boolean_example (\n  example BOOLEAN\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/boolean', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/boolean');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (14, 22, 'DEC, NUMERIC, FIXED', 'Syntax\n------\n\nDEC[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nNUMERIC[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nFIXED[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nThese types are synonyms for DECIMAL. The FIXED synonym is available for compatibility with other database systems.\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/dec-numeric-fixed', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/dec-numeric-fixed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (15, 22, 'DECIMAL', 'Syntax\n------\n\nDECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA packed "exact" fixed-point number. M is the total number of digits (the precision), and D is the number of digits after the decimal point (the scale).\n\n The decimal point and (for negative numbers) the "-" sign are not counted in M.\n If D is 0, values have no decimal point or fractional part, and on INSERT, the value will be rounded to the nearest DECIMAL.\n The maximum number of digits (M) for DECIMAL is 65.\n The maximum number of supported decimals (D) is 30 before MariadB 10.2.1 and 38 afterwards.\n If D is omitted, the default is 0. If M is omitted, the default is 10.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of digits specified by M.\n\nAll basic calculations (+, -, \\, /) with DECIMAL columns are done with a precision of 65 digits.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nDEC, NUMERIC, and FIXED are synonyms, as well as NUMBER in Oracle mode.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);\nQuery OK, 6 rows affected, 2 warnings (0.16 sec)\nRecords: 6  Duplicates: 0  Warnings: 2\n\nNote (sql 1265): Data truncated for column ''d'' at row 5\nNote (sql 1265): Data truncated for column ''d'' at row 6\n\nSELECT * FROM t1;\n+------------+\n| d          |\n+------------+\n| 0000000001 |\n| 0000000002 |\n| 0000000003 |\n| 0000000004 |\n| 0000000005 |\n| 0000000006 |\n+------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/decimal', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/decimal');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (16, 22, 'DOUBLE PRECISION', 'Syntax\n------\n\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nREAL and DOUBLE PRECISION are synonyms for DOUBLE.\n\nException: If the REAL_AS_FLOAT SQL mode is enabled, REAL is a synonym for FLOAT rather than DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE double_precision_example (\n  example DOUBLE PRECISION\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double-precision', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double-precision');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (17, 22, 'DOUBLE', 'Syntax\n------\n\nDOUBLE[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nDOUBLE PRECISION[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\nREAL[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size (double-precision) floating-point number (see FLOAT for a single-precision floating-point number). Allowable values are:\n\n -1.7976931348623157E+308 to -2.2250738585072014E-308\n 0\n 2.2250738585072014E-308 to 1.7976931348623157E+308\n\nThese are the theoretical limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the decimal point. If M and D are omitted, values are stored to the limits allowed by the hardware. A double-precision floating-point number is accurate to approximately 15 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nZEROFILL, if specified, pads the number with zeros, up to the total number of digits specified by M.\n\nREAL and DOUBLE PRECISION are synonyms, unless the REAL_AS_FLOAT SQL mode is enabled, in which case REAL is a synonym for FLOAT rather than DOUBLE.\n\nSee Floating Point Accuracy for issues when using floating-point numbers.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE t1 (d DOUBLE(5,0) zerofill);\n\nINSERT INTO t1 VALUES (1),(2),(3),(4);\n\nSELECT  FROM t1;\n+-------+\n| d     |\n+-------+\n| 00001 |\n| 00002 |\n| 00003 |\n| 00004 |\n+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/double');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (18, 22, 'FIXED', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE fixed_example (\n  example FIXED\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/fixed', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/fixed');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (19, 22, 'FLOAT', 'Syntax\n------\n\nFLOAT[(M,D)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small (single-precision) floating-point number (see DOUBLE for a regular-size floating point number). Allowable values are:\n\n -3.402823466E+38 to -1.175494351E-38\n 0\n* 1.175494351E-38 to 3.402823466E+38.\n\nThese are the theoretical limits, based on the IEEE standard. The actual range might be slightly smaller depending on your hardware or operating system.\n\nM is the total number of digits and D is the number of digits following the decimal point. If M and D are omitted, values are stored to the limits allowed by the hardware. A single-precision floating-point number is accurate to approximately 7 decimal places.\n\nUNSIGNED, if specified, disallows negative values.\n\nUsing FLOAT might give you some unexpected problems because all calculations in MariaDB are done with double precision. See Floating Point Accuracy.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE float_signed_example (\n  description VARCHAR(20),\n  example FLOAT,\n  sz6_2 FLOAT(6,2),\n  sz20_19 FLOAT(20,19) SIGNED\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (20, 22, 'FLOAT4', 'Description\n-----------\n\nSee FLOAT.\n\nExamples\n--------\n\nCREATE TABLE float4_example (\n  example FLOAT4\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float4', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (21, 22, 'FLOAT8', 'Description\n-----------\n\nSee DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE float8_example (\n  example FLOAT8\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float8', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float8');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (22, 22, 'Floating-point Accuracy', 'Description\n-----------\n\nDue to their nature, not all floating-point numbers can be stored with exact precision. Hardware architecture, the CPU or even the compiler version and optimization level may affect the precision.\n\nIf you are comparing DOUBLEs or FLOATs with numeric decimals, it is not safe to use the equality operator.\n\nSometimes, changing a floating-point number from single-precision (FLOAT) to double-precision (DOUBLE) will fix the problem.\n\nExamples\n--------\n\nCREATE TABLE fpn (id INT, f1 FLOAT, f2 DOUBLE, f3 DECIMAL (10,3));\nINSERT INTO fpn VALUES (1,2,2,2),(2,0.1,0.1,0.1);\n\nSELECT  FROM fpn WHERE f1f1 = f2*f2;\n+------+------+------+-------+\n| id   | f1   | f2   | f3    |\n+------+------+------+-------+\n|    1 |    2 |    2 | 2.000 |\n+------+------+------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/floating-point-accuracy', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/floating-point-accuracy');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (23, 22, 'INT', 'Syntax\n------\n\nINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\nINTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA normal-size integer. When marked UNSIGNED, it ranges from 0 to 4294967295, otherwise its range is -2147483648 to 2147483647 (SIGNED is the default). If a column has been set to ZEROFILL, all values will be prepended by zeros so that the INT value contains a number of M digits. INTEGER is a synonym for INT.\n\nNote: If the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nINT4 is a synonym for INT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE ints (a INT,b INT UNSIGNED,c INT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (24, 22, 'INT1', 'Description\n-----------\n\nINT1 is a synonym for TINYINT.\n\n``sql\nCREATE TABLE t1 (x INT1);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| x     | tinyint(4) | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int1_example (\n  example INT1\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int1', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int1');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (25, 22, 'INT2', 'Description\n-----------\n\nINT2 is a synonym for SMALLINT.\n\n``sql\nCREATE TABLE t1 (x INT2);\n\nDESC t1;\n+-------+-------------+------+-----+---------+-------+\n| Field | Type        | Null | Key | Default | Extra |\n+-------+-------------+------+-----+---------+-------+\n| x     | smallint(6) | YES  |     | NULL    |       |\n+-------+-------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int2_example (\n  example INT2\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int2', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (26, 22, 'INT3', 'Description\n-----------\n\nINT3 is a synonym for MEDIUMINT.\n\n``sql\nCREATE TABLE t1 (x INT3);\n\nDESC t1;\n+-------+--------------+------+-----+---------+-------+\n| Field | Type         | Null | Key | Default | Extra |\n+-------+--------------+------+-----+---------+-------+\n| x     | mediumint(9) | YES  |     | NULL    |       |\n+-------+--------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int3_example (\n  example INT3\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int3', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int3');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (27, 22, 'INT4', 'Description\n-----------\n\nINT4 is a synonym for INT.\n\n``sql\nCREATE TABLE t1 (x INT4);\n\nDESC t1;\n+-------+---------+------+-----+---------+-------+\n| Field | Type    | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| x     | int(11) | YES  |     | NULL    |       |\n+-------+---------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int4_example (\n  example INT4\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int4', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (28, 22, 'INT8', 'Description\n-----------\n\nINT8 is a synonym for BIGINT.\n\n``sql\nCREATE TABLE t1 (x INT8);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| x     | bigint(20) | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nExamples\n--------\n\nCREATE TABLE int8_example (\n  example INT8\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int8', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/int8');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (29, 22, 'INTEGER', 'Syntax\n------\n\nINTEGER[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nThis type is a synonym for INT.\n\nExamples\n--------\n\nCREATE TABLE integer_example (\n  example INTEGER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/integer', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/integer');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (30, 22, 'MEDIUMINT', 'Syntax\n------\n\nMEDIUMINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA medium-sized integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.\n\nZEROFILL pads the integer with zeroes and assumes UNSIGNED (even if UNSIGNED is not specified).\n\nINT3 is a synonym for MEDIUMINT.\n\nFor details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE mediumints (a MEDIUMINT,b MEDIUMINT UNSIGNED,c MEDIUMINT ZEROFILL);\n\nDESCRIBE mediumints;\n+-------+--------------------------------+------+-----+---------+-------+\n| Field | Type                           | Null | Key | Default | Extra |\n+-------+--------------------------------+------+-----+---------+-------+\n| a     | mediumint(9)                   | YES  |     | NULL    |       |\n| b     | mediumint(8) unsigned          | YES  |     | NULL    |       |\n| c     | mediumint(8) unsigned zerofill | YES  |     | NULL    |       |\n+-------+--------------------------------+------+-----+---------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/mediumint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/mediumint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (31, 22, 'MIDDLEINT', 'Description\n-----------\n\nSee MEDIUMINT.\n\nExamples\n--------\n\nCREATE TABLE middleint_example (\n  example MIDDLEINT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/middleint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/middleint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (32, 22, 'NUMBER', 'Description\n-----------\n\n``sql\nNUMBER[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]\n`\n\nIn Oracle mode, NUMBER` is a synonym for DECIMAL.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/number', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/number');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (33, 22, 'Numeric Data Type Overview', 'Description\n-----------\n\nThere are a number of numeric data types:\n\n BOOLEAN - Synonym for TINYINT(1)\n INT1 - Synonym for TINYINT\n INT2 - Synonym for SMALLINT\n INT3 - Synonym for MEDIUMINT\n INT, INTEGER\n INT4 - Synonym for INT\n INT8 - Synonym for BIGINT\n TINYINT\n SMALLINT\n MEDIUMINT\n BIGINT\n DECIMAL, DEC, NUMERIC, FIXED\n FLOAT\n DOUBLE, DOUBLE PRECISION, REAL\n BIT\n VECTOR\n\nSee the specific articles for detailed information on each.\n\nSIGNED, UNSIGNED and ZEROFILL\n\nMost numeric types can be defined as SIGNED, UNSIGNED or ZEROFILL, for example:\n\n``sql\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n`\n\nIf SIGNED, or no attribute, is specified, a portion of the numeric type will be reserved for the sign (plus or minus). For example, a TINYINT SIGNED can range from -128 to 127.\n\nIf UNSIGNED is specified, no portion of the numeric type is reserved for the sign, so for integer types range can be larger. For example, a TINYINT UNSIGNED can range from 0 to 255. Floating point and fixed-point types also can be UNSIGNED, but this only prevents negative values from being stored and doesn''t alter the range.\n\nIf ZEROFILL is specified, the column will be set to UNSIGNED and the spaces used by default to pad the field are replaced with zeros. ZEROFILL is ignored in expressions or as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB enhancement.\n\nNote that although the preferred syntax indicates that the attributes are exclusive, more than one attribute can be specified.\n\nOnly the following combinations are supported:\n\n SIGNED\n UNSIGNED\n ZEROFILL\n UNSIGNED ZEROFILL\n ZEROFILL UNSIGNED\n\nThe latter two should be replaced with simply ZEROFILL`, but are still accepted by the parser.\n\nExamples\n--------\n\nCREATE TABLE zf (\n  i1 TINYINT SIGNED,\n  i2 TINYINT UNSIGNED,\n  i3 TINYINT ZEROFILL\n);\n\nINSERT INTO zf VALUES (2,2,2);\n\nSELECT  FROM zf;\n+------+------+------+\n| i1   | i2   | i3   |\n+------+------+------+\n|    2 |    2 |  002 |\n+------+------+------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-type-overview', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-type-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (34, 22, 'DEC', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE dec_example (\n  example DEC\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-types-dec', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric-data-types-dec');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (35, 22, 'NUMERIC', 'Description\n-----------\n\nSee DECIMAL.\n\nExamples\n--------\n\nCREATE TABLE numeric_example (\n  example NUMERIC\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/numeric');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (36, 22, 'REAL', 'Description\n-----------\n\nSee DOUBLE.\n\nExamples\n--------\n\nCREATE TABLE real_example (\n  example REAL\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/real', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/real');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (37, 22, 'SMALLINT', 'Syntax\n------\n\nSMALLINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.\n\nIf a column has been set to ZEROFILL, all values will be prepended by zeros so that the SMALLINT value contains a number of M digits.\n\nNote:\n\nIf the ZEROFILL attribute has been specified, the column will automatically become UNSIGNED.\n\nINT2 is a synonym for SMALLINT.\n\nFor more details on the attributes, see Numeric Data Type Overview.\n\nExamples\n--------\n\nCREATE TABLE smallints (a SMALLINT,b SMALLINT UNSIGNED,c SMALLINT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/smallint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/smallint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (38, 22, 'TINYINT', 'Syntax\n------\n\nTINYINT[(M)] [SIGNED | UNSIGNED | ZEROFILL]\n\nDescription\n-----------\n\nA very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255. For details on the attributes, see Numeric Data Type Overview.\n\nINT1, BOOL, and BOOLEAN are synonyms for TINYINT.\n\nExamples\n--------\n\nCREATE TABLE tinyints (a TINYINT,b TINYINT UNSIGNED,c TINYINT ZEROFILL);\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/tinyint', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/tinyint');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (39, 22, 'VECTOR', 'Syntax\n------\n\nVECTOR(N)\n\nDescription\n-----------\n\nThe VECTOR data type was added as part of the vectors feature, which permits MariaDB Server to perform as a relational vector database. N represents the fixed number of dimensions of the vector up to a maximum of 16383. The N dimension will be determined by the embedding algorithm.\n\nExamples\n--------\n\nCREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, v VECTOR(5) NOT NULL,\n VECTOR INDEX (v));\n\nURL: https://mariadb.com/docs/server/reference/data-types/numeric-data-types/vector', '', 'https://mariadb.com/docs/server/reference/data-types/numeric-data-types/vector');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (40, 22, 'ROW TYPE OF', 'Description\n-----------\n\nThis is special declaration only available inside a stored procedure.\n\nExamples\n--------\n\nCREATE TABLE rowtypeof_table(\n  descr VARCHAR(20),\n  val INT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/row-type-of', '', 'https://mariadb.com/docs/server/reference/data-types/row-type-of');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (41, 22, 'SERIAL', 'Description\n-----------\n\nThis is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.\n\nExamples\n--------\n\nCREATE TABLE serial_example (\n  id SERIAL,\n  data VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/serial', '', 'https://mariadb.com/docs/server/reference/data-types/serial');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (42, 22, 'BINARY', 'Description\n-----------\n\nThe BINARY type is similar to the CHAR type, but stores binary byte strings rather than non-binary character strings. M represents the column length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the numeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the extra characters will be dropped with a warning. If strict mode is enabled, an error will occur.\n\nBINARY values are right-padded with 0x00 (the zero byte) to the specified length when inserted. The padding is _not_ removed on select, so this needs to be taken into account when sorting and comparing, where all bytes are significant. The zero byte, 0x00 is less than a space for comparison purposes.\n\nUse Cases for Zero Length\n\nA BINARY(0) or VARBINARY(0) column is restricted to an empty byte string or NULL.\n\n Schema Preservation: Use these columns when a system expects a specific column to exist, but no data storage is required for your current application.\n Space-Efficient Indicators: These columns can act as a two-state indicator where the presence of an empty byte string represents one state and NULL represents another.\n\nIf you attempt to insert a value other than an empty string, MariaDB returns an ERROR 1406 (22001) indicating the data is too long for the column.\n\nExamples\n--------\n\nCREATE TABLE bins (a BINARY(10));\n\nINSERT INTO bins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM bins;\n+------------+\n| a          |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=''STRICT_ALL_TABLES'';\n\nINSERT INTO bins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/binary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/binary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (43, 22, 'BLOB and TEXT Data Types', 'Description\n-----------\n\nA BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are\n\n TINYBLOB,\n BLOB,\n MEDIUMBLOB, and\n LONGBLOB.\n\nThese differ only in the maximum length of the values they can hold.\n\nThe TEXT types are\n\n TINYTEXT,\n TEXT,\n MEDIUMTEXT, and\n LONGTEXT.\n JSON (alias for LONGTEXT)\n\nThese correspond to the four BLOB types and have the same maximum lengths and storage requirements.\n\nBLOB and TEXT columns can have a DEFAULT value.\n\nIt is possible to set a unique index on columns that use the BLOB or TEXT data types.\n\nHandling Large Data via APIs\n\nWhen working with very large BLOB or TEXT values, the data may exceed the limit set by the max_allowed_packet system variable. To avoid this—and to reduce memory consumption on the client—most MariaDB connectors allow you to "stream" data in chunks.\n\n Connector/C: Use mysql_stmt_send_long_data() to send parameter data in pieces before calling mysql_stmt_execute(). This bypasses max_allowed_packet  limits and reduces the peak memory footprint (RSS) of the application.\n Connector/J: Use PreparedStatement.setBinaryStream() (for BLOB) or PreparedStatement.setCharacterStream() (for TEXT).\n Protocol: These APIs utilize the COM_STMT_SEND_LONG_DATA command, which appends data to a parameter on the server side.\n\nTechnical Rules for C/C++\n\n 0-Based Indexing: Parameter numbering starts at 0.\n The  is_null Flag: This must be 0; if set to nonzero, the server may discard the streamed data.\n Resetting: Use  mysql_stmt_reset() to clear all accumulated long data on the server if you need to abort or retry.\n Chunk Size: A practical performance "sweet spot" is between 64 KB and 1 MB per chunk.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/blob-and-text-data-types', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/blob-and-text-data-types');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (44, 22, 'BLOB', 'Syntax\n------\n\nBLOB[(M)]\n\nDescription\n-----------\n\nIf you are handling large binary data that exceeds the max_allowed_packet limit, you can stream the data in chunks using specialized API functions like mysql_stmt_send_long_data() or setBinaryStream(). See Handling Large Data via APIs for more details.\n\nA BLOB column with a maximum length of 65,535 (2¹⁶ - 1) bytes. Each BLOB value is stored using a two-byte length prefix that indicates the number of bytes in the value.\n\nAn optional length M can be given for this type. If this is done, MariaDB creates the column as the smallest BLOB type large enough to hold values _M_ bytes long.\n\nBLOB values can also be used to store dynamic columns.\n\nBLOB and TEXT columns can both be assigned a DEFAULT value.\n\nIndexing\n\nOn a column that uses the BLOB data type, setting a unique index is now possible.\n\nNote\n\nIn previous releases, setting a unique index on a column that uses the BLOB data type was not possible. Index would only guarantee the uniqueness of a fixed number of characters.\n\nOracle Mode\n\nIn Oracle mode, BLOB is a synonym for LONGBLOB.\n\nExamples\n--------\n\nCREATE TABLE blob_example (\n   description VARCHAR(20),\n   example BLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/blob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/blob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (45, 22, 'CHAR BYTE', 'Description\n-----------\n\nThe CHAR BYTE data type is an alias for the BINARY data type. This is a compatibility feature.\n\nExamples\n--------\n\nCREATE TABLE char_byte_example (\n  example CHAR BYTE\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char-byte', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char-byte');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (46, 22, 'CHAR VARYING', 'Description\n-----------\n\nThis is a synonym for VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE char_varying_example (\n  example CHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (47, 22, 'CHAR', 'Syntax\n------\n\n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA fixed-length string that is always right-padded with spaces to the specified length when stored. M represents the column length in characters. The range of M is 0 to 255. If M is omitted, the length is 1.\n\nTrailing spaces are removed when CHAR values are retrieved unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nIf a unique index consists of a column where trailing pad characters are stripped or ignored, inserts into that column where values differ only by the number of trailing pad characters will result in a duplicate-key error.\n\nCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns cannot be part of an index. The CONNECT storage engine does not support CHAR(0).\n\nUse Cases for Zero Length\n\nA CHAR(0) or VARCHAR(0) column occupies minimal space and is restricted to two possible values: an empty string ('''') or NULL. You can use these columns for the following purposes:\n\n Legacy Compatibility: Include these columns to maintain compatibility with older applications that require a specific table schema, even if the data is no longer collected.\n Two-State Flags: A CHAR(0) NULL column can function as a boolean indicator. It uses only one bit of storage to distinguish between a "set" state (the empty string) and an "unset" state (NULL).\n* Row Marking: You can use a CHAR(0) column to mark a specific row in a table. For example, if you require only one "active" row, set that row to an empty string while keeping all other rows NULL.\n\nThe following error occurs if you attempt to insert any character data into a 0-length column: ERROR 1406 (22001): Data too long for column.\n\nExamples\n--------\n\nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES(''Maria   '');\n\nSELECT c=''Maria'',c=''Maria   '' FROM strtest;\n+-----------+--------------+\n| c=''Maria'' | c=''Maria   '' |\n+-----------+--------------+\n|         1 |            1 |\n+-----------+--------------+\n\nSELECT c LIKE ''Maria'',c LIKE ''Maria   '' FROM strtest;\n+----------------+-------------------+\n| c LIKE ''Maria'' | c LIKE ''Maria   '' |\n+----------------+-------------------+\n|              1 |                 0 |\n+----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/char');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (48, 22, 'Character Set and Collation Overview', 'Description\n-----------\n\nWhat are Character Sets and Collations?\n\nA character set is a set of characters, while a collation comprises the rules for comparing and sorting a particular character set.\n\nFor example, a subset of a character set could consist of the letters A, B and C. A default collation could define these as appearing in an ascending order of A, B, C.\n\nIf we consider different case characters, more complexity is added. A binary collation would evaluate the characters A and a differently, ordering them in a particular way. A case-insensitive collation would evaluate A and a equivalently, while the German phone book collation evaluates the characters ue and ü equivalently.\n\nA character set can have many collations associated with it, while each collation is only associated with one character set. In MariaDB, the character set name is always part of the collation name. For example, the latin1_german1_ci collation applies only to the latin1 character set. Each character set also has one default collation. The latin1 default collation is latin1_swedish_ci.\n\nAs an example, by default, the character y comes between x and z, while in Lithuanian, it''s sorted between i and k. Similarly, the German phone book order is different to the German dictionary order, so while they share the same character set, the collation is different.\n\nViewing Character Sets and Collations\n\nThe default character set is utf8mb4 and the default collation is utf8mb4_uca1400_ai_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nThe default character set is latin1 and the default collation is latin1_swedish_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nYou can view a full list of character sets and collations supported by MariaDB at Supported Character Sets and Collations, or see what''s supported on your server with the SHOW CHARACTER SET and SHOW COLLATION commands.\n\nBy default, A comes before Z, so the following evaluates to true:\n\n``sql\nSELECT "A" < "Z";\n+-----------+\n| "A" < "Z" |\n+-----------+\n|         1 |\n+-----------+\n`\n\nBy default, comparisons are case-insensitive:\n\n`sql\nSELECT "A" < "a", "A" = "a";\n+-----------+-----------+\n| "A" < "a" | "A" = "a" |\n+-----------+-----------+\n|         0 |         1 |\n+-----------+-----------+\n`\n\nChanging Character Sets and Collations\n\nCharacter sets and collations can be set from the server level right down to the column level, as well as for client-server communication.\n\nFor example, ue and ü are by default evaluated differently.\n\n`sql\nSELECT ''Mueller'' = ''Müller'';\n+----------------------+\n| ''Müller'' = ''Mueller'' |\n+----------------------+\n|                    0 |\n+----------------------+\n`\n\nBy using the collation_connection system variable to change the connection character set to latin1_german2_ci, or German phone book, the same two characters will evaluate as equivalent.\n\n`sql\nSET collation_connection = latin1_german2_ci;\n\nSELECT ''Mueller'' = ''Müller'';\n+-----------------------+\n| ''Mueller'' = ''Müller''  |\n+-----------------------+\n|                     1 |\n+-----------------------+\n``\n\nSee Setting Character Sets and Collations for more.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (49, 22, 'Coordinated Universal Time', 'Description\n-----------\n\nUTC stands for Coordinated Universal Time. It is the world standard for regulating time.\n\nMariaDB stores values internally in UTC, converting them to the required time zone as required.\n\nIn general terms it is equivalent to Greenwich Mean Time (GMT), but UTC is used in technical contexts, as it is precisely defined at the subsecond level.\n\nTime zones are offset relative to UTC. For example, time in Tonga is UTC + 13, so 03h00 UTC is 16h00 in Tonga.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/coordinated-universal-time', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/coordinated-universal-time');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (50, 22, 'Locales Plugin', 'Description\n-----------\n\nThe LOCALES plugin creates the LOCALES table in the INFORMATION_SCHEMA database. The plugin also adds the SHOW LOCALES statement.The table and statement can be queried to see all locales that are compiled into the server.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN. For example:\n\n``sql\nINSTALL SONAME ''locales'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file. For example:\n\n`sql\n[mariadb]\n...\nplugin_load_add = locales\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN. For example:\n\n`sql\nUNINSTALL SONAME ''locales'';\n``\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nExamples\n--------\n\nSELECT * FROM INFORMATION_SCHEMA.LOCALES;\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n| ID  | NAME  | DESCRIPTION                         | MAX_MONTH_NAME_LENGTH | MAX_DAY_NAME_LENGTH | DECIMAL_POINT | THOUSAND_SEP | ERROR_MESSAGE_LANGUAGE |\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n|   0 | en_US | English - United States             |                     9 |                   9 | .             | ,            | english                |\n|   1 | en_GB | English - United Kingdom            |                     9 |                   9 | .             | ,            | english                |\n|   2 | ja_JP | Japanese - Japan                    |                     3 |                   3 | .             | ,            | japanese               |\n|   3 | sv_SE | Swedish - Sweden                    |                     9 |                   7 | ,             |              | swedish                |\n|   4 | de_DE | German - Germany                    |                     9 |                  10 | ,             | .            | german                 |\n|   5 | fr_FR | French - France                     |                     9 |                   8 | ,             |              | french                 |\n|   6 | ar_AE | Arabic - United Arab Emirates       |                     6 |                   8 | .             | ,            | english                |\n|   7 | ar_BH | Arabic - Bahrain                    |                     6 |                   8 | .             | ,            | english                |\n|   8 | ar_JO | Arabic - Jordan                     |                    12 |                   8 | .             | ,            | english                |\n...\n| 106 | no_NO | Norwegian - Norway                  |                     9 |                   7 | ,             | .            | norwegian              |\n| 107 | sv_FI | Swedish - Finland                   |                     9 |                   7 | ,             |              | swedish                |\n| 108 | zh_HK | Chinese - Hong Kong SAR             |                     3 |                   3 | .             | ,            | english                |\n| 109 | el_GR | Greek - Greece                      |                    11 |                   9 | ,             | .            | greek                  |\n| 110 | rm_CH | Romansh - Switzerland               |                     9 |                   9 | ,             | .            | english                |\n+-----+-------+-------------------------------------+-----------------------+---------------------+---------------+--------------+------------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/locales-plugin', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/locales-plugin');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (51, 22, 'Server Locale', 'Description\n-----------\n\nThe lc_time_names server system variable sets the language used by the date and time functions DAYNAME(), MONTHNAME(), and DATE_FORMAT(), and the lc_messages sets the language for error messages.\n\nThe list of the locales supported by the current MariaDB installation can be obtained via the LOCALES plugin.\n\nMariaDB supports the following locale values:\n\n| Locale | Language          | Territory                                                                                                                                                                                                                                                     |\n| ------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ar_AE | Arabic            | United Arab Emirates                                                                                                                                                                                                                                          |\n| ar_BH | Arabic            | Bahrain                                                                                                                                                                                                                                                       |\n| ar_DZ | Arabic            | Algeria                                                                                                                                                                                                                                                       |\n| ar_EG | Arabic            | Egypt                                                                                                                                                                                                                                                         |\n| ar_IN | Arabic            | Iran                                                                                                                                                                                                                                                          |\n| ar_IQ | Arabic            | Iraq                                                                                                                                                                                                                                                          |\n| ar_JO | Arabic            | Jordan                                                                                                                                                                                                                                                        |\n| ar_KW | Arabic            | Kuwait                                                                                                                                                                                                                                                        |\n| ar_LB | Arabic            | Lebanon                                                                                                                                                                                                                                                       |\n| ar_LY | Arabic            | Libya                                                                                                                                                                                                                                                         |\n| ar_MA | Arabic            | Morocco                                                                                                                                                                                                                                                       |\n| ar_OM | Arabic            | Oman                                                                                                                                                                                                                                                          |\n| ar_QA | Arabic            | Qatar                                                                                                                                                                                                                                                         |\n| ar_SA | Arabic            | Saudi Arabia                                                                                                                                                                                                                                                  |\n| ar_SD | Arabic            | Sudan                                                                                                                                                                                                                                                         |\n| ar_SY | Arabic            | Syria                                                                                                                                                                                                                                                         |\n| ar_TN | Arabic            | Tunisia                                                                                                                                                                                                                                                       |\n| ar_YE | Arabic            | Yemen                                                                                                                                                                                                                                                         |\n| be_BY | Belarusian        | Belarus                                                                                                                                                                                                                                                       |\n| bg_BG | Bulgarian         | Bulgaria                                                                                                                                                                                                                                                      |\n| ca_ES | Catalan           | Catalan                                                                                                                                                                                                                                                       |\n| cs_CZ | Czech             | Czech Republic                                                                                                                                                                                                                                                |\n| da_DK | Danish            | Denmark                                                                                                                                                                                                                                                       |\n| de_AT | German            | Austria                                                                                                                                                                                                                                                       |\n| de_BE | German            | Belgium                                                                                                                                                                                                                                                       |\n| de_CH | German            | Switzerland                                                                                                                                                                                                                                                   |\n| de_DE | German            | Germany                                                                                                                                                                                                                                                       |\n| de_LU | German            | Luxembourg                                                                                                                                                                                                                                                    |\n| el_GR | Greek             | Greece                                                                                                                                                                                                                                                        |\n| en_AU | English           | Australia                                                                                                                                                                                                                                                     |\n| en_CA | English           | Canada                                                                                                                                                                                                                                                        |\n| en_GB | English           | United Kingdom                                                                                                                                                                                                                                                |\n| en_IN | English           | India                                                                                                                                                                                                                                                         |\n| en_NZ | English           | New Zealand                                                                                                                                                                                                                                                   |\n| en_PH | English           | Philippines                                                                                                                                                                                                                                                   |\n| en_US | English           | United States                                                                                                                                                                                                                                                 |\n| en_ZA | English           | South Africa                                                                                                                                                                                                                                                  |\n| en_ZW | English           | Zimbabwe                                                                                                                                                                                                                                                      |\n| es_AR | Spanish           | Argentina                                                                                                                                                                                                                                                     |\n| es_BO | Spanish           | Bolivia                                                                                                                                                                                                                                                       |\n| es_CL | Spanish           | Chile                                                                                                                                                                                                                                                         |\n| es_CO | Spanish           | Columbia                                                                                                                                                                                                                                                      |\n| es_CR | Spanish           | Costa Rica                                                                                                                                                                                                                                                    |\n| es_DO | Spanish           | Dominican Republic                                                                                                                                                                                                                                            |\n| es_EC | Spanish           | Ecuador                                                                                                                                                                                                                                                       |\n| es_ES | Spanish           | Spain                                                                                                                                                                                                                                                         |\n| es_GT | Spanish           | Guatemala                                                                                                                                                                                                                                                     |\n| es_HN | Spanish           | Honduras                                                                                                                                                                                                                                                      |\n| es_MX | Spanish           | Mexico                                                                                                                                                                                                                                                        |\n| es_NI | Spanish           | Ni\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/server-locale');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (52, 22, 'Setting the Language for Error Messages', 'Description\n-----------\n\nMariaDB server error messages are by default in English. However, MariaDB server also supports error message localization in many different languages. Each supported language has its own version of the error message file called errmsg.sys in a dedicated directory for that language.\n\nSupported Languages for Error Messages\n\nError message localization is supported for the following languages:\n\n Bulgarian\n Chinese (from MariaDB 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3)\n Czech\n Danish\n Dutch\n English\n Estonian\n French\n Georgian (from MariaDB 10.11.3)\n German\n Greek\n Hindi\n Hungarian\n Italian\n Japanese\n Korean\n Norwegian\n Norwegian-ny (Nynorsk)\n Polish\n Portuguese\n Romanian\n Russian\n Serbian\n Slovak\n Spanish\n Swahili (from MariaDB 11.1.2)\n Swedish\n Ukrainian\n\nSetting the lc_messages and lc_messages_dir System Variables\n\nThe lc_messages and lc_messages_dir system variables can be used to set the server locale used for error messages.\n\nThe lc_messages system variable can be specified as a locale name. The language of the associated locale will be used for error messages. See Server Locales for a list of supported locales and their associated languages.\n\nThe lc_messages system variable is set to en_US by default, which means that error messages are in English by default.\n\nIf the lc_messages system variable is set to a valid locale name, but the server can''t find an error message file for the language associated with the locale, then the default language will be used instead.\n\nThis system variable can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file. For example:\n\n``ini\n[mariadb]\n...\nlc_messages=fr_CA\n`\n\nThe lc_messages system variable can also be changed dynamically with SET GLOBAL. For example:\n\n`sql\nSET GLOBAL lc_messages=''fr_CA'';\n`\n\nIf a server has the lc_messages system variable set to the fr_CA locale like the above example, then error messages would be in French. For example:\n\n`sql\nSELECT blah;\nERROR 1054 (42S22): Champ ''blah'' inconnu dans field list\n`\n\nThe lc_messages_dir system variable can be specified either as the path to the directory storing the server''s error message files or as the path to the directory storing the specific language''s error message file.\n\nThe server initially tries to interpret the value of the lc_messages_dir system variable as a path to the directory storing the server''s error message files. Therefore, it constructs the path to the language''s error message file by concatenating the value of the lc_messages_dir system variable with the language name of the locale specified by the lc_messages system variable .\n\nIf the server does not find the error message file for the language, then it tries to interpret the value of the lc_messages_dir system variable as a direct path to the directory storing the specific language''s error message file.\n\nThis system variable can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file.\n\nFor example, to specify the path to the directory storing the server''s error message files:\n\n`ini\n[mariadb]\n...\nlc_messages_dir=/usr/share/mysql/\n`\n\nOr to specify the path to the directory storing the specific language''s error message file:\n\n`ini\n[mariadb]\n...\nlc_messages_dir=/usr/share/mysql/french/\n`\n\nThe lc_messages_dir system variable can not be changed dynamically.\n\nSetting the --language Option\n\nThe --language option can also be used to set the server''s language for error messages, but it is deprecated. It is recommended to set the lc_messages system variable instead.\n\nThe --language option can be specified either as a language name or as the path to the directory storing the language''s error message file. See Server Locales for a list of supported locales and their associated languages.\n\nThis option can be specified as command-line arguments to mariadbd or it can be specified in a relevant server option group in an option file.\n\nFor example, to specify a language name:\n\n`ini\n[mariadb]\n...\nlanguage=french\n`\n\nOr to specify the path to the directory storing the language''s error message file:\n\n`ini\n[mariadb]\n...\nlanguage=/usr/share/mysql/french/\n``\n\nCharacter Set\n\nThe character set that the error messages are returned in is determined by the character_set_results variable, which defaults to UTF8.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/setting-the-language-for-error-messages', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/setting-the-language-for-error-messages');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (53, 22, 'Time Zones', 'Description\n-----------\n\nMariaDB keeps track of several time zone settings.\n\nSetting the Time Zone\n\nThe time_zone system variable is the primary way to set the time zone. It can be specified in one of the following formats:\n\n The default value is SYSTEM, which indicates that the system time zone defined in the system_time_zone system variable will be used. Note that if you are using SYSTEM with replication in either statement or mixed mode, you MUST use the same value for system_time_zone on all slaves (otherwise TIMESTAMP columns will not replicate correctly). See System Time Zone below for more information.\n An offset from Coordinated Universal Time (UTC), such as +5:00 or -9:00, can also be used.\n If the time zone tables in the mysql database were loaded, then a named time zone, such as America/New_York, Africa/Johannesburg, or Europe/Helsinki, is also permissible. See mysql Time Zone Tables below for more information.\n\nThere are two time zone settings that can be set within MariaDB--the global server time zone, and the time zone for your current session. There is also a third time zone setting which may be relevant--the system time zone.\n\nGlobal Server Time Zone\n\nThe global server time zone can be changed at server startup by setting the --default-time-zone option either on the command-line or in a server option group in an option file. For example:\n\n``ini\n[mariadb]\n...\ndefault_time_zone = ''America/New_York''\n`\n\nThe global server time zone can also be changed dynamically by setting the time_zone system variable as a user account that has the SUPER privilege. For example:\n\n`sql\nSET GLOBAL time_zone = ''America/New_York'';\n`\n\nThe current global server time zone can be viewed by looking at the global value of the time_zone system variable. For example:\n\n`sql\nSHOW GLOBAL VARIABLES LIKE ''time_zone'';\n+---------------+--------+\n| Variable_name | Value  |\n+---------------+--------+\n| time_zone     | SYSTEM |\n+---------------+--------+\n`\n\nSession Time Zone\n\nEach session that connects to the server will also have its own time zone. This time zone is initially inherited from the global value of the time_zone system variable, which sets the session value of the same variable.\n\nA session''s time zone can be changed dynamically by setting the time_zone system variable. For example:\n\n`sql\nSET time_zone = ''America/New_York'';\n`\n\nThe current session time zone can be viewed by looking at the session value of the time_zone system variable. For example:\n\n`sql\nSHOW SESSION VARIABLES LIKE ''time_zone'';\n+---------------+--------+\n| Variable_name | Value  |\n+---------------+--------+\n| time_zone     | SYSTEM |\n+---------------+--------+\n`\n\nSystem Time Zone\n\nThe system time zone is determined when the server starts, and it sets the value of the system_time_zone system variable. The system time zone is usually read from the operating system''s environment. You can change the system time zone in several different ways, such as:\n\n If you are starting the server with mariadbd-safe, then you can set the system time zone with the --timezone option either on the command-line or in the \\[mariadbd-safe] option group in an option file. For example:\n\n`ini\n[mariadbd-safe]\ntimezone=''America/New_York''\n`\n\n If you are using a Unix-like operating system, then you can set the system time zone by setting the TZ environment variable in your shell before starting the server. For example:\n\n`bash\n$ export TZ=''America/New_York''\n$ service mariadb start\n`\n\n On some Linux operating systems, you can change the default time zone for the whole system by making the /etc/localtime symbolic link point to the desired time zone. For example:\n\n`bash\n$ sudo rm /etc/localtime\n$ sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime\n`\n\n On some Debian-based Linux operating systems, you can change the default time zone for the whole system by executing the following:\n\n`bash\nsudo dpkg-reconfigure tzdata\n`\n\n On Linux operating systems that use systemd, you can change the default time zone for the whole system by using the timedatectl utility. For example:\n\n`bash\nsudo timedatectl set-timezone America/New_York\n``\n\nTime Zone Effects\n\nTime Zone Effects on Functions\n\nSome functions are affected by the time zone settings. These include:\n\n NOW()\n SYSDATE()\n CURDATE()\n CURTIME()\n UNIX_TIMESTAMP()\n\nSome functions are not affected. These include:\n\n UTC_DATE()\n UTC_TIME()\n UTC_TIMESTAMP()\n\nTime Zone Effects on Data Types\n\nSome data types are affected by the time zone settings.\n\n TIMESTAMP - See TIMESTAMP: Time Zones for information on how this data type is affected by time zones.\n DATETIME - See DATETIME: Time Zones for information on how this data type is affected by time zones.\n\nmysql Time Zone Tables\n\nThe mysql database contains a number of time zone tables:\n\n time_zone\n time_zone_leap_second\n time_zone_name\n time_zone_transition\n* time_zone_transition_type\n\nBy default, these time zone tables in the mysql database are created, but not populated.\n\nIf you are using a Unix-like operating system, then you can populate these tables using the mariadb-tzinfo-to-sql utility, which uses the zoneinfo data available on Linux, Mac OS X, FreeBSD and Solaris.\n\nIf you are using Windows, then you will need to import pre-populated time zone tables. These are available at MariaDB mirrors.\n\nTime zone data needs to be updated on occasion. When that happens, the time zone tables may need to be reloaded.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/internationalization-and-localization/time-zones');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (54, 22, 'SET CHARACTER SET', 'Syntax\n------\n\nSET {CHARACTER SET | CHARSET}\n    {charset_name | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client and character_set_results session system variables to the specified character set and collation_connection to the value of collation_database, which implicitly sets character_set_connection to the value of character_set_database.\n\nThis maps all strings sent between the current client and the server with the given mapping.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE ''character_set_%'';\n+--------------------------+--------+\n| Variable_name            | Value  |\n+--------------------------+--------+\n| character_set_client     | utf8   |\n| character_set_connection | utf8   |\n| character_set_database   | latin1 |\n| character_set_filesystem | binary |\n| character_set_results    | utf8   |\n| character_set_server     | latin1 |\n| character_set_system     | utf8   |\n+--------------------------+--------+\n\nSHOW VARIABLES LIKE ''collation%'';\n+----------------------+-------------------+\n| Variable_name        | Value             |\n+----------------------+-------------------+\n| collation_connection | utf8_general_ci   |\n| collation_database   | latin1_swedish_ci |\n| collation_server     | latin1_swedish_ci |\n+----------------------+-------------------+\n\nSET CHARACTER SET utf8mb4;\n\nSHOW VARIABLES LIKE ''character_set_%'';\n+--------------------------+---------+\n| Variable_name            | Value   |\n+--------------------------+---------+\n| character_set_client     | utf8mb4 |\n| character_set_connection | latin1  |\n| character_set_database   | latin1  |\n| character_set_filesystem | binary  |\n| character_set_results    | utf8mb4 |\n| character_set_server     | latin1  |\n| character_set_system     | utf8    |\n+--------------------------+---------+\n\nSHOW VARIABLES LIKE ''collation%'';\n+----------------------+-------------------+\n| Variable_name        | Value             |\n+----------------------+-------------------+\n| collation_connection | latin1_swedish_ci |\n| collation_database   | latin1_swedish_ci |\n| collation_server     | latin1_swedish_ci |\n+----------------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-character-set', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-character-set');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (55, 22, 'SET NAMES', 'Syntax\n------\n\nSET NAMES {''charset_name''\n    [COLLATE ''collation_name''] | DEFAULT}\n\nDescription\n-----------\n\nSets the character_set_client, character_set_connection, character_set_results and, implicitly, the collation_connection session system variables to the specified character set and collation.\n\nThis determines which character set the client will use to send statements to the server, and the server will use for sending results back to the client.\n\nucs2, utf16, utf16le and utf32 are not valid character sets for SET NAMES, as they cannot be used as client character sets.\n\nThe collation clause is optional. If not defined (or if DEFAULT is specified), the default collation for the character set will be used.\n\nQuotes are optional for the character set or collation clauses.\n\nExamples\n--------\n\nSET NAMES DEFAULT;                \n\nSELECT VARIABLE_NAME, SESSION_VALUE \n    FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE \n    VARIABLE_NAME LIKE ''character_set_con%'' OR \n    VARIABLE_NAME LIKE ''character_set_cl%'' OR \n    VARIABLE_NAME LIKE ''character_set_re%'' OR \n    VARIABLE_NAME LIKE ''collation_c%'';\n+--------------------------+-----------------------+\n| VARIABLE_NAME            | SESSION_VALUE         |\n+--------------------------+-----------------------+\n| CHARACTER_SET_RESULTS    | utf8mb4               |\n| CHARACTER_SET_CONNECTION | utf8mb4               |\n| CHARACTER_SET_CLIENT     | utf8mb4               |\n| COLLATION_CONNECTION     | utf8mb4_uca1400_ai_ci |\n+--------------------------+-----------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-names', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/set-names');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (56, 22, 'Setting Character Sets and Collations', 'Description\n-----------\n\nThe default character set is utf8mb4 and the default collation is utf8mb4_uca1400_ai_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nThe default character set is latin1 and the default collation is latin1_swedish_ci.\\\nThis may differ in some distros, see for example Differences in MariaDB in Debian.\n\nIn MariaDB 11.6, the default character set changed from latin1 to utf8mb4.\n\nWhen upgrading to 11.6 or above from a previous release series, this can lead to behavior different from what you''ve been seeing in the old version.\n\nSee this section for details, including the impact on replicating to older MariaDB (or MySQL) slaves.\n\nThe character sets and the collations can be specified from the server right down to the column level, as well as for client-server connections. When changing a character set and not specifying a collation, the default collation for the new character set is always used.\n\nCharacter sets and collations always cascade down, so a column without a specified collation will look for the table default, the table for the database, and the database for the server. It''s therefore possible to have extremely fine-grained control over all the character sets and collations used in your data.\n\nDefault collations for each character set can be viewed with the SHOW COLLATION statement, for example, to find the default collation for the latin2 character set:\n\n``sql\nSHOW COLLATION LIKE ''latin2%'';\n+---------------------+---------+----+---------+----------+---------+\n| Collation           | Charset | Id | Default | Compiled | Sortlen |\n+---------------------+---------+----+---------+----------+---------+\n| latin2_czech_cs     | latin2  |  2 |         | Yes      |       4 |\n| latin2_general_ci   | latin2  |  9 | Yes     | Yes      |       1 |\n| latin2_hungarian_ci | latin2  | 21 |         | Yes      |       1 |\n| latin2_croatian_ci  | latin2  | 27 |         | Yes      |       1 |\n| latin2_bin          | latin2  | 77 |         | Yes      |       1 |\n+---------------------+---------+----+---------+----------+---------+\n`\n\nServer Level\n\nThe character_set_server system variable can be used to change the default server character set. It can be set both on startup or dynamically, with the SET command:\n\n`sql\nSET character_set_server = ''latin2'';\n`\n\nSimilarly, the collation_server variable is used for setting the default server collation.\n\n`sql\nSET collation_server = ''latin2_czech_cs'';\n`\n\nDatabase Level\n\nThe CREATE DATABASE and ALTER DATABASE statements have optional character set and collation clauses. If these are left out, the server defaults are used.\n\n`sql\nCREATE DATABASE czech_slovak_names \n  CHARACTER SET = ''keybcs2''\n  COLLATE = ''keybcs2_bin'';\n`\n\n`sql\nALTER DATABASE czech_slovak_names COLLATE = ''keybcs2_general_ci'';\n`\n\nTo determine the default character set used by a database, use:\n\n`sql\nSHOW CREATE DATABASE czech_slovak_names;\n+--------------------+--------------------------------------------------------------------------------+\n| Database           | Create Database                                                                |\n+--------------------+--------------------------------------------------------------------------------+\n| czech_slovak_names | CREATE DATABASE czech_slovak_names /!40100 DEFAULT CHARACTER SET keybcs2 / |\n+--------------------+--------------------------------------------------------------------------------+\n`\n\nAlternatively, for the character set and collation:\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.SCHEMATA;\n+--------------+--------------------+----------------------------+------------------------+----------+\n| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |\n+--------------+--------------------+----------------------------+------------------------+----------+\n| def          | czech_slovak_names | keybcs2                    | keybcs2_general_ci     | NULL     |\n| def          | information_schema | utf8                       | utf8_general_ci        | NULL     |\n| def          | mysql              | latin1                     | latin1_swedish_ci      | NULL     |\n| def          | performance_schema | utf8                       | utf8_general_ci        | NULL     |\n| def          | test               | latin1                     | latin1_swedish_ci      | NULL     |\n+--------------+--------------------+----------------------------+------------------------+----------+\n`\n\nIt is also possible to specify only the collation, and, since each collation only applies to one character set, the associated character set will automatically be specified.\n\n`sql\nCREATE DATABASE danish_names COLLATE ''utf8_danish_ci'';\n\nSHOW CREATE DATABASE danish_names;\n+--------------+----------------------------------------------------------------------------------------------+\n| Database     | Create Database                                                                              |\n+--------------+----------------------------------------------------------------------------------------------+\n| danish_names | CREATE DATABASE danish_names /!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_danish_ci / |\n+--------------+----------------------------------------------------------------------------------------------+\n`\n\nAlthough there are character_set_database and collation_database system variables which can be set dynamically, these are used for determining the character set and collation for the default database, and should only be set by the server.\n\nTable Level\n\nThe CREATE TABLE and ALTER TABLE statements support optional character set and collation clauses, a MariaDB and MySQL extension to standard SQL.\n\n`sql\nCREATE TABLE english_names (id INT, name VARCHAR(40)) \n  CHARACTER SET ''utf8'' \n  COLLATE ''utf8_icelandic_ci'';\n`\n\nIf neither character set nor collation is provided, the database default will be used. If only the character set is provided, the default collation for that character set will be used . If only the collation is provided, the associated character set will be used. See Supported Character Sets and Collations.\n\n`sql\nALTER TABLE table_name\n CONVERT TO CHARACTER SET charset_name [COLLATE collation_name];\n`\n\nIf no collation is provided, the collation will be set to the default collation for that character set. See Supported Character Sets and Collations.\n\nFor VARCHAR or TEXT columns, CONVERT TO CHARACTER SET changes the data type if needed to ensure the new column is long enough to store as many characters as the original column.\n\nFor example, an ascii TEXT column requires a single byte per character, so the column can hold up to 65,535 characters. If the column is converted to utf8mb4, 4 bytes can be required for each character, so the column will be converted to MEDIUMTEXT to be able to hold the same number of characters.\n\nCONVERT TO CHARACTER SET binary will convert CHAR, VARCHAR and TEXT columns to BINARY, VARBINARY and BLOB respectively, and from that point will no longer have a character set, or be affected by future CONVERT TO CHARACTER SET statements.\n\nTo avoid data type changes resulting from CONVERT TO CHARACTER SET, use MODIFY on the individual columns instead. For example:\n\n`sql\nALTER TABLE table_name MODIFY ascii_text_column TEXT CHARACTER SET utf8;\nALTER TABLE table_name MODIFY ascii_varchar_column VARCHAR(M) CHARACTER SET utf8;\n`\n\nColumn Level\n\nCharacter sets and collations can also be specified for columns that are character types CHAR, TEXT or VARCHAR. The CREATE TABLE and ALTER TABLE statements support optional character set and collation clauses for this purpose - unlike those at the table level, the column level definitions are standard SQL.\n\n`sql\nCREATE TABLE european_names (\n  croatian_names VARCHAR(40) COLLATE ''cp1250_croatian_ci'',\n  greek_names VARCHAR(40) CHARACTER SET ''greek'');\n`\n\nIf neither collation nor character set is provided, the table default is used. If only the character set is specified, that character set''s default collation is used, while if only the collation is specified, the associated character set is used.\n\nWhen using ALTER TABLE to change a column''s character set, you need to ensure the character sets are compatible with your data. MariaDB will map the data as best it can, but it''s possible to lose data if care is not taken.\n\nThe SHOW CREATE TABLE statement or INFORMATION SCHEMA database can be used to determine column character sets and collations.\n\n`sql\nSHOW CREATE TABLE european_names\\G\n*********************** 1. row ***********************\n       Table: european_names\nCreate Table: CREATE TABLE european_names (\n  croatian_names varchar(40) CHARACTER SET cp1250 COLLATE cp1250_croatian_ci DEFAULT NULL,\n  greek_names varchar(40) CHARACTER SET greek DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_danish_ci\n`\n\n`sql\nSELECT  FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME LIKE ''european%''\\G\n************************ 1. row *********************\n           TABLE_CATALOG: def\n            TABLE_SCHEMA: danish_names\n              TABLE_NAME: european_names\n             COLUMN_NAME: croatian_names\n        ORDINAL_POSITION: 1\n          COLUMN_DEFAULT: NULL\n             IS_NULLABLE: YES\n               DATA_TYPE: varchar\nCHARACTER_MAXIMUM_LENGTH: 40\n  CHARACTER_OCTET_LENGTH: 40\n       NUMERIC_PRECISION: NULL\n           NUMERIC_SCALE: NULL\n      DATETIME_PRECISION: NULL\n      CHARACTER_SET_NAME: cp1250\n          COLLATION_NAME: cp1250_croatian_ci\n             COLUMN_TYPE: varchar(40)\n              COLUMN_KEY: \n                   EXTRA: \n              PRIVILEGES: select,insert,update,references\n          COLUMN_COMMENT: \n********************* 2. row ***********************\n           TABLE_CATALOG: def\n            TABLE_SCHEMA: danish_names\n              TABLE_NAME: european_names\n             COLUMN_NAME: greek_names\n        ORDINAL_POSITION: 2\n          COLUMN_DEFAULT: NULL\n             IS_NULLABLE: YES\n               DATA_TYPE: varchar\nCHARACTER_MAXIMUM_LENGTH: 40\n  CHARACTER_OCTET_LENGTH: 40\n       NUMERIC_PRECISION: NULL\n           NUMERIC_SCALE: NULL\n      DATETIME_PRECISION: NULL\n      CHARACTER_SET_NAME: greek\n          COLLATION_NAME: greek_general_ci\n             COLUMN_TYPE: varchar(40)\n              COLUMN_KEY: \n                   EXTRA: \n              PRIVILEGES: select,insert,update,references\n          COLUMN_COMMENT:\n`\n\nFilenames\n\nThe character_set_filesystem system variable has controlled interpretation of file names that are given as literal strings. This affects the following statements and functions:\n\n SELECT INTO DUMPFILE\n SELECT INTO OUTFILE\n LOAD DATA INFILE\n LOAD XML\n LOAD_FILE()\n\nLiterals\n\nBy default, the character set and collation used for literals is determined by the character_set_connection and collation_connection system variables. However, they can also be specified explicitly:\n\n`sql\n[_charset_name]''string'' [COLLATE collation_name]\n`\n\nThe character set of string literals that do not have a character set introducer is determined by the character_set_connection system variable.\n\nThis query always returns the same character set name in both columns.:\n\n`sql\nSELECT CHARSET(''a''), @@character_set_connection;\n`\n\ncharacter_set_client and character_set_connection are normally (e.g. during handshake, or after a SET NAMES` query) are set to equal values. However, it''s possible to set to different values.\n\nExamples\n--------\n\nCREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_general_ci;\nINSERT INTO t1 VALUES (''oe''),(''ö'');\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/setting-character-sets-and-collations', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/setting-character-sets-and-collations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (57, 22, 'Supported Character Sets and Collations', 'Description\n-----------\n\nCharacter Sets\n\nYou can see which character sets are available in a particular version by running the SHOW CHARACTER SET statement or by querying the Information Schema CHARACTER_SETS Table.\n\nIt is possible to change the default collation associated with a character set. See Changing Default Collation.\n\nIt is not possible to change the default collation associated with a character set. See Changing Default Collation\n\nMariaDB supports the following character sets:\n\n| Charset  | Description                 | Default collation                                                                                                                                                                                                                                                                                                 | Maxlen                                                                               |\n| -------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |\n| armscii8 | ARMSCII-8 Armenian          | armscii8_general_ci                                                                                                                                                                                                                                                                                             | 1                                                                                    |\n| ascii    | US ASCII                    | ascii_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| big5     | Big5 Traditional Chinese    | big5_chinese_ci                                                                                                                                                                                                                                                                                                 | 2                                                                                    |\n| binary   | Binary pseudo charset       | binary                                                                                                                                                                                                                                                                                                            | 1                                                                                    |\n| cp1250   | Windows Central European    | cp1250_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1251   | Windows Cyrillic            | cp1251_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1256   | Windows Arabic              | cp1256_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp1257   | Windows Baltic              | cp1257_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| cp850    | DOS West European           | cp850_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp852    | DOS Central European        | cp852_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp866    | DOS Russian                 | cp866_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| cp932    | SJIS for Windows Japanese   | cp932_japanese_ci                                                                                                                                                                                                                                                                                               | 2                                                                                    |\n| dec8     | DEC West European           | dec8_swedish_ci                                                                                                                                                                                                                                                                                                 | 1                                                                                    |\n| eucjpms  | UJIS for Windows Japanese   | eucjpms_japanese_ci                                                                                                                                                                                                                                                                                             | 3                                                                                    |\n| euckr    | EUC-KR Korean               | euckr_korean_ci                                                                                                                                                                                                                                                                                                 | 2                                                                                    |\n| gb2312   | GB2312 Simplified Chinese   | gb2312_chinese_ci                                                                                                                                                                                                                                                                                               | 2                                                                                    |\n| gbk      | GBK Simplified Chinese      | gbk_chinese_ci                                                                                                                                                                                                                                                                                                  | 2                                                                                    |\n| geostd8  | GEOSTD8 Georgian            | geostd8_general_ci                                                                                                                                                                                                                                                                                              | 1                                                                                    |\n| greek    | ISO 8859-7 Greek            | greek_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| hebrew   | ISO 8859-8 Hebrew           | hebrew_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| hp8      | HP West European            | hp8_english_ci                                                                                                                                                                                                                                                                                                  | 1                                                                                    |\n| keybcs2  | DOS Kamenicky Czech-Slovak  | keybcs2_general_ci                                                                                                                                                                                                                                                                                              | 1                                                                                    |\n| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| koi8u    | KOI8-U Ukrainian            | koi8u_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| latin1   | cp1252 West European        | latin1_swedish_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin2   | ISO 8859-2 Central European | latin2_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin5   | ISO 8859-9 Turkish          | latin5_turkish_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| latin7   | ISO 8859-13 Baltic          | latin7_general_ci                                                                                                                                                                                                                                                                                               | 1                                                                                    |\n| macce    | Mac Central European        | macce_general_ci                                                                                                                                                                                                                                                                                                | 1                                                                                    |\n| macroman | Mac West European           | macroman_general_ci                                                                                                                                                                                                                                                                                             | 1                                                                                    |\n| sjis     | Shift-JIS Japanese          | sjis_japanese_ci                                                                                                                                                                                                                                                                                                | 2                                                                                    |\n| swe7     | 7bit Swedish                | swe7_swedish_ci\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/supported-character-sets-and-collations');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (58, 22, 'Unicode', 'Description\n-----------\n\nUnicode is a standard for encoding text across multiple writing systems. MariaDB supports a number of character sets for storing Unicode data:\n\n| Character Set | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |\n| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ucs2        | UCS-2, each character is represented by a 2-byte code with the most significant byte first. Fixed-length 16-bit encoding.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |\n| utf8        | utf8 is an alias for utf8mb3, but this can changed to ut8mb4 by changing the default value of the old_mode system variable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n| utf8mb3     | UTF-8 encoding using one to three bytes per character. Basic Latin letters, numbers and punctuation use one byte. European and Middle East letters mostly fit into 2 bytes. Korean, Chinese, and Japanese ideographs use 3-bytes. No supplementary characters are stored. Until MariaDB 10.5, this was an alias for utf8. From MariaDB 10.6, utf8 is by default an alias for utf8mb3, but this can changed to ut8mb4 by changing the default value of the old_mode system variable. |\n| utf8mb4     | UTF-8 encoding the same as utf8mb3 but which stores supplementary characters in four bytes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |\n| utf16       | UTF-16, same as ucs2, but stores supplementary characters in 32 bits. 16 or 32-bits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| utf32       | UTF-32, fixed-length 32-bit encoding.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n\nSupport for the UCA-14.0.0 collations was added in MariaDB 10.10 (MDEV-27009).\n\nSupport for the MySQL 8.0 UCA-9-0-0 (utf8mb4_0900_...) collations will be added to MariaDB 11.4.5.\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/unicode', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/unicode');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (59, 22, 'CHARACTER', 'Description\n-----------\n\nThis is a synonym for CHAR.\n\nExamples\n--------\n\nCREATE TABLE character_example (\n  example CHARACTER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/character', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/character');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (60, 22, 'CLOB', 'Description\n-----------\n\nThis is a synonym for LONGTEXT.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nCREATE TABLE clob_example (\n  example CLOB\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/clob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/clob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (61, 22, 'ENUM', 'Syntax\n------\n\nENUM(''value1'',''value2'',...) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nAn enumeration. A string object that can have only one value, chosen from the list of values ''value1'', ''value2'', ..., NULL or the special '''' error value. In theory, an ENUM column can have a maximum of 65,535 distinct values; in practice, the real maximum depends on many factors. ENUM values are represented internally as integers.\n\nTrailing spaces are automatically stripped from ENUM values on table creation.\n\nENUM values require relatively little storage space compared to strings, either one or two bytes depending on the number of enumeration values.\n\nNULL and empty values\n\nAn ENUM can also contain NULL and empty values. If the ENUM column is declared to permit NULL values, NULL becomes a valid value, as well as the default value (see below). If strict SQL Mode is not enabled, and an invalid value is inserted into an ENUM, a special empty string, with an index value of zero (see Numeric index, below), is inserted, with a warning. This may be confusing, because the empty string is also a possible value, and the only difference if that is this case its index is not 0. Inserting will fail with an error if strict mode is active.\n\nIf a DEFAULT clause is missing, the default value will be:\n\n NULL if the column is nullable;\n otherwise, the first value in the enumeration.\n\nNumeric index\n\nENUM values are indexed numerically in the order they are defined, and sorting will be performed in this numeric order. We suggest not using ENUM to store numerals, as there is little to no storage space benefit, and it is easy to confuse the enum integer with the enum numeral value by leaving out the quotes.\n\nAn ENUM defined as ENUM(''apple'',''orange'',''pear'') would have the following index values:\n\n| Index | Value    |\n| ----- | -------- |\n| NULL  | NULL     |\n| 0     | ''''       |\n| 1     | ''apple''  |\n| 2     | ''orange'' |\n| 3     | ''pear''   |\n\nExamples\n--------\n\nCREATE TABLE fruits (\n  id INT NOT NULL auto_increment PRIMARY KEY,\n  fruit ENUM(''apple'',''orange'',''pear''),\n  bushels INT);\n\nDESCRIBE fruits;\n+---------+-------------------------------+------+-----+---------+----------------+\n| Field   | Type                          | Null | Key | Default | Extra          |\n+---------+-------------------------------+------+-----+---------+----------------+\n| id      | int(11)                       | NO   | PRI | NULL    | auto_increment |\n| fruit   | enum(''apple'',''orange'',''pear'') | YES  |     | NULL    |                |\n| bushels | int(11)                       | YES  |     | NULL    |                |\n+---------+-------------------------------+------+-----+---------+----------------+\n\nINSERT INTO fruits\n    (fruit,bushels) VALUES\n    (''pear'',20),\n    (''apple'',100),\n    (''orange'',25);\n\nINSERT INTO fruits\n    (fruit,bushels) VALUES\n    (''avocado'',10);\nERROR 1265 (01000): Data truncated for column ''fruit'' at row 1\n\nSELECT * FROM fruits;\n+----+--------+---------+\n| id | fruit  | bushels |\n+----+--------+---------+\n|  1 | pear   |      20 |\n|  2 | apple  |     100 |\n|  3 | orange |      25 |\n+----+--------+---------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/enum', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/enum');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (62, 22, 'INET4', 'Syntax\n------\n\nINET4\n\nDescription\n-----------\n\nINET4 is a data type to store IPv4 addresses, as 4-byte binary strings.\n\nCasting from INET4 data types to INET6 is permitted, allowing for example comparisons between the two data types, and for INET4 values to be inserted into INET6 columns.\n\nCasting from INET4 data types to INET6 is not permitted.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 (a INET4);\n\nINSERT INTO t1 VALUES(''0.0.0.0''), (''255.10.0.0''), (''255.255.255.255'');\n\nINSERT INTO t1 VALUES (0xa0000001);\nINSERT INTO t1 VALUES (0xf0000000);\nINSERT INTO t1 VALUES (0xff000001);\n\nSELECT HEX(a), a FROM t1 ORDER BY a;\n+----------+-----------------+\n| HEX(a)   | a               |\n+----------+-----------------+\n| 00000000 | 0.0.0.0         |\n| A0000001 | 160.0.0.1       |\n| F0000000 | 240.0.0.0       |\n| FF000001 | 255.0.0.1       |\n| FF0A0000 | 255.10.0.0      |\n| FFFFFFFF | 255.255.255.255 |\n+----------+-----------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/inet4', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/inet4');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (63, 22, 'INET6', 'Syntax\n------\n\nINET6\n\nDescription\n-----------\n\nThe INET6 data type is intended for storage of IPv6 addresses, as well as IPv4 addresses assuming conventional mapping of IPv4 addresses into IPv6 addresses.\n\nBoth short and long IPv6 notation are permitted, according to RFC-5952.\n\n Values are stored as a 16-byte fixed length binary string, with most significant byte first.\n Storage engines see INET6 as BINARY(16).\n Clients see INET6 as CHAR(39) and get text representation on retrieval.\n\nThe IPv4-compatible notation is considered as deprecated. It is supported for compatibility with the INET6_ATON function, which also understands this format. It''s recommended to use the mapped format to store IPv4 addresses in INET6.\n\nWhen an IPv4 mapped (or compatible) value is stored in INET6, it still occupies 16 bytes:\n\nRetrieval\n\nOn retrieval, in the client-server text protocol, INET6 values are converted to the short text representation, according to RFC-5952, that is with all leading zeroes in each group removed and with consequent zero groups compressed.\n\nBesides creating one''s own stored function, there is no a way to retrieve an INET6 value using long text representation.\n\nCasting\n\n CAST from a character string to INET6 understands addresses in short or long text notation (including IPv4 mapped and compatible addresses). NULL is returned if the format is not understood.\n CAST from a binary string to INET6 requires a 16-byte string as an argument. NULL is returned if the argument length is not equal to 16.\n CAST from other data types to INET6 first converts data to a character string, then CAST from character string to INET6 is applied.\n CAST from INET6 to CHAR returns short text address notation.\n CAST from INET6 to BINARY returns its 16-byte binary string representation.\n CAST from INET6 to data types other than CHAR (e.g. SIGNED, UNSIGNED, TIME, etc) returns an error.\n\nComparisons\n\nAn INET6 expression can be compared to:\n\n another INET6 expression\n a character string expression with a text (short or long) address representation:\n a 16-byte binary string expression.\n\nAttempting to compare INET6 to an expression of any other data type returns an error.\n\nMixing INET6 Values for Result\n\nAn INET6 expression can be mixed for result (i.e. UNION, CASE..THEN, COALESCE etc) with:\n\n another INET6 expression. The resulting data type is INET6.\n a character string in text (short or long) address representation. The result data type is INET6. The character string counterpart is automatically converted to INET6. If the string format is not understood, it''s converted with a warning to either NULL or to ''::'', depending on the NULL-ability of the result.\n a 16-byte binary string. The resulting data type is INET6. The binary string counterpart is automatically converted to INET6. If the length of the binary string is not equal to 16, it''s converted with a warning to NULL or to ''::'' depending on the NULL-ability of the result.\n\nAttempts to mix INET6 for result with other data types will return an error.\n\nMixing INET6 with other data types for LEAST and GREATEST, when mixing for comparison and mixing for result are involved at the same time, uses the same rules with mixing for result, described in the previous paragraphs.\n\nFunctions and Operators\n\n HEX() with an INET6 argument returns a hexadecimal representation of the underlying 16-byte binary string\n Arithmetic operators (+,-,\\,/,MOD,DIV) are not supported for INET6. This may change in the future.\n The INET6_ATON function now understands INET6 values as an argument\n The prototypes of the IS_IPV4_COMPAT and I S_IPV4_MAPPED functions have changed from a BINARY(16) to a INET6,\n\nWhen the argument for the aforementioned two functions is not INET6, automatic implicit CAST to INET6 is applied. As a consequence, both functions understand arguments in both text representation and binary(16) representation.\n\nWhen the argument for the aforementioned two functions is not INET6, automatic implicit CAST to INET6 is not applied.\n\nPrepared Statement Parameters\n\nINET6 understands both text and binary(16) address representation in prepared statement parameters (PREPARE..EXECUTE and EXECUTE IMMEDIATE statements).\n\nMigration between BINARY(16) and INET6\n\nYou may have used BINARY(16) as a storage for IPv6 internet addresses, in combination with INET6_ATON and INET6_NTOA to respectively insert and retrieve data.\n\nHowever, you can ALTER BINARY(16) columns storing IPv6 addresses to INET6. After such an alter, there is no a need to use INET6_ATON() and INET6_NTOA(). Addresses can be inserted and retrieved directly.\n\nYou may use BINARY(16) as a storage for IPv6 internet addresses, in combination with INET6_ATON and INET6_NTOA to respectively insert and retrieve data.\n\nIt is also possible to convert INET6 columns to BINARY(16) and continue using the data in combination with INET6_NTOA() and INET6_ATON().\n\nExamples\n--------\n\nCREATE TABLE t1 (a INET6);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/inet6');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (64, 22, 'JSON Data Type', 'Description\n-----------\n\nThe JSON alias was added to make it possible to use JSON columns in statement based replication from MySQL to MariaDB and to make it possible for MariaDB to read mysqldumps from MySQL.\n\nJSON is an alias for LONGTEXT COLLATE utf8mb4_bin introduced for compatibility reasons with MySQL''s JSON data type. MariaDB implements this as a LONGTEXT rather, as the JSON data type contradicts the SQL:2016 standard, and MariaDB''s benchmarks indicate that performance is at least equivalent.\n\nIn order to ensure that a valid json document is inserted, the JSON_VALID function can be used as a CHECK constraint. This constraint is automatically included for types using the JSON alias.\n\nThe assigned text value is retained verbatim. If a value fails JSON_VALID(), an error is raised. This CHECK constraint can also be manually added to any LONGTEXT field. When a JSON object contains duplicate keys, only the first key-value pair is accessible via functions like JSON_EXTRACT().\n\nExamples\n--------\n\nCREATE TABLE t (j JSON);\n\nDESC t;\n+-------+----------+------+-----+---------+-------+\n| Field | Type     | Null | Key | Default | Extra |\n+-------+----------+------+-----+---------+-------+\n| j     | longtext | YES  |     | NULL    |       |\n+-------+----------+------+-----+---------+-------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/json', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/json');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (65, 22, 'LONG and LONG VARCHAR', 'Description\n-----------\n\nLONG and LONG VARCHAR are synonyms for MEDIUMTEXT.\n\n``sql\nCREATE TABLE t1 (a LONG, b LONG VARCHAR);\n\nDESC t1;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| a     | mediumtext | YES  |     | NULL    |       |\n| b     | mediumtext | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-and-long-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-and-long-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (66, 22, 'LONG CHAR VARYING', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_char_varying_example (\n  example LONG CHAR VARYING\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (67, 22, 'LONG CHARACTER VARYING', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_character_varying_example (\n  example LONG CHARACTER VARYING\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-character-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-character-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (68, 22, 'LONG VARBINARY', 'Description\n-----------\n\nSee MEDIUMBLOB.\n\nExamples\n--------\n\nCREATE TABLE long_varbinary_example (\n  example LONG VARBINARY\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varbinary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (69, 22, 'LONG VARCHAR', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_varchar_example (\n  example LONG VARCHAR\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (70, 22, 'LONG VARCHARACTER', 'Description\n-----------\n\nSee MEDIUMTEXT.\n\nExamples\n--------\n\nCREATE TABLE long_varcharacter_example (\n  example LONG VARCHARACTER\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/long-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (71, 22, 'LONGBLOB', 'Syntax\n------\n\nLONGBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 4,294,967,295 bytes (2³² - 1), or 4GB. The effective maximum length of LONGBLOB columns depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGBLOB value is stored using a four-byte length prefix that indicates the number of bytes in the value.\n\nOracle Mode\n\nIn Oracle mode, BLOB is a synonym for LONGBLOB.\n\nExamples\n--------\n\nCREATE TABLE longblob_example (\n   description VARCHAR(20),\n   example LONGBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/longblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/longblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (72, 22, 'LONGTEXT', 'Syntax\n------\n\nLONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 4,294,967,295 or 4GB (2³² - 1) characters. The effective maximum length is less if the value contains multi-byte characters. The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory. Each LONGTEXT value is stored using a four-byte length prefix that indicates the number of bytes in the value.\n\nJSON is an alias for LONGTEXT. See JSON Data Type for details.\n\nOracle Mode\n\nIn Oracle mode, CLOB is a synonym for LONGTEXT.\n\nExamples\n--------\n\nCREATE TABLE longtext_example (\n   description VARCHAR(20),\n   example LONGTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/longtext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/longtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (73, 22, 'MEDIUMBLOB', 'Syntax\n------\n\nMEDIUMBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 16,777,215 (2²⁴ - 1) bytes. Each MEDIUMBLOB value is stored using a three-byte length prefix that indicates the number of bytes in the value.\n\nLONG VARBINARY is a synonym for MEDIUMBLOB .\n\nExamples\n--------\n\nCREATE TABLE mediumblob_example (\n   description VARCHAR(20),\n   example MEDIUMBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (74, 22, 'MEDIUMTEXT', 'Syntax\n------\n\nMEDIUMTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 16,777,215 (2²⁴ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each MEDIUMTEXT value is stored using\\\na three-byte length prefix that indicates the number of bytes in the value.\n\nSYNONYMS\n\nThe following are synonyms for MEDIUMTEXT:\n\n LONG\n LONG CHAR VARYING\n LONG CHARACTER VARYING\n LONG VARCHAR\n* LONG VARCHARACTER\n\nExamples\n--------\n\nCREATE TABLE mediumtext_example (\n   description VARCHAR(20),\n   example MEDIUMTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumtext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/mediumtext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (75, 22, 'NATIONAL CHAR VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_char_varying_example (\n  example NATIONAL CHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (76, 22, 'NATIONAL CHAR', 'Description\n-----------\n\nFixed-length string of specific character set with limit up to 255 bytes.\n\nExamples\n--------\n\nCREATE TABLE national_char_example (\n  example NATIONAL CHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-char');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (77, 22, 'NATIONAL CHARACTER VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_character_varying_example (\n  example NATIONAL CHARACTER VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (78, 22, 'NATIONAL CHARACTER', 'Description\n-----------\n\nSee NATIONAL CHAR.\n\nExamples\n--------\n\nCREATE TABLE national_character_example (\n  example NATIONAL CHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-character');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (79, 22, 'NATIONAL VARCHAR', 'Description\n-----------\n\nVariable-length string of specific character set with limit up to 65,535 bytes.\n\nExamples\n--------\n\nCREATE TABLE national_varchar_example (\n  example NATIONAL VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (80, 22, 'NATIONAL VARCHARACTER', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE national_varcharacter_example (\n  example NATIONAL VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/national-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (81, 22, 'NCHAR VARCHAR', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varchar_example (\n  example NCHAR VARCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (82, 22, 'NCHAR VARCHARACTER', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varcharacter_example (\n  example NCHAR VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (83, 22, 'NCHAR VARYING', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_varying_example (\n  example NCHAR VARYING(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varying', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar-varying');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (84, 22, 'NCHAR', 'Description\n-----------\n\nSee NATIONAL VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE nchar_example (\n  example NCHAR(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/nchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (85, 22, 'RAW', 'Description\n-----------\n\nSee VARBINARY.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/raw', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/raw');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (86, 22, 'ROW', 'Syntax\n------\n\nROW (<field name> <data type> [{, <field name> <data type>}... ])\n\nDescription\n-----------\n\nROW is a data type for stored procedure variables.\n\nFeatures\n\nROW fields as normal variables\n\nROW fields (members) act as normal variables, and are able to appear in all query parts where a stored procedure variable is allowed:\n\n Assignment is using the := operator and the SET command:\n\n``sql\na.x:= 10;\na.x:= b.x;\nSET a.x= 10, a.y=20, a.z= b.z;\n`\n\n Passing to functions and operators:\n\n`sql\nSELECT f1(rec.a), rec.a<10;\n`\n\n Clauses (select list, WHERE, HAVING, LIMIT, etc...,):\n\n`sql\nSELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c;\n`\n\n INSERT values:\n\n`sql\nINSERT INTO t1 VALUES (rec.a, rec.b, rec.c);\n`\n\n SELECT .. INTO targets:\n\n`sql\nSELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10;\n`\n\n Dynamic SQL out parameters (EXECUTE and EXECUTE IMMEDIATE)\n\n`sql\nEXECUTE IMMEDIATE ''CALL proc_with_out_param(?)'' USING rec.a;\n`\n\nROW type variables as FETCH targets\n\nROW type variables are allowed as FETCH targets:\n\n`sql\nFETCH cur INTO rec;\n`\n\nwhere cur is a CURSOR and rec is a ROW type stored procedure variable.\n\nNote, currently an attempt to use FETCH for a ROW type variable returns this error:\n\n`sql\nERROR 1328 (HY000): Incorrect number of FETCH variables\n`\n\nFETCH from a cursor cur into a ROW variable rec works as follows:\n\n The number of fields in cur must match the number of fields in rec. Otherwise, an error is reported.\n Assignment is done from left to right. The first cursor field is assigned to the first variable field, the second cursor field is assigned to the second variable field, etc.\n Field names in rec are not important and can differ from field names in cur.\n\nSee FETCH Examples (below) for examples of using this withsql_mode=ORACLE and sql_mode=DEFAULT.\n\nROW type variables as SELECT...INTO targets\n\nROW type variables are allowed as SELECT..INTO targets with some differences depending on which sql_mode is in use.\n\n When using sql_mode=ORACLE, table%ROWTYPE and cursor%ROWTYPE variables can be used as SELECT...INTO targets.\n Using multiple ROW variables in the SELECT..INTO list will report an error.\n Using ROW variables with a different column count than in the SELECT..INTO list will report an error.\n\nSee SELECT...INTO Examples (below) for examples of using this with sql_mode=ORACLE and sql_mode=DEFAULT.\n\nFeatures not implemented\n\nThe following features are planned, but not implemented yet:\n\n Returning a ROW type expression from a stored function (see MDEV-12252). This will need some grammar change to support field names after parentheses:\n\n`sql\nSELECT f1().x FROM DUAL;\n`\n\n Returning a ROW type expression from a built-in hybrid type function, such as CASE, IF, etc.\n* ROW of ROW` values\n\nExamples\n--------\n\nDELIMITER $$\nCREATE PROCEDURE p1()\nBEGIN\n  DECLARE r ROW (c1 INT, c2 VARCHAR(10));\n  SET r.c1= 10;\n  SET r.c2= ''test'';\n  INSERT INTO t1 VALUES (r.c1, r.c2);\nEND;\n$$\nDELIMITER ;\nCALL p1();\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/row', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/row');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (87, 22, 'SET Data Type', 'Syntax\n------\n\nSET(''value1'',''value2'',...) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA set. A string object that can have zero or more values, each of which must be chosen from the list of values ''value1'', ''value2'', ... A SET column can have a maximum of 64 members. SET values are\\\nrepresented internally as integers.\n\nSET values cannot contain commas.\n\nIf a SET contains duplicate values, an error will be returned if strict mode is enabled, or a warning if strict mode is not enabled.\n\nExamples\n--------\n\nCREATE TABLE set_example (\n  description VARCHAR(20),\n  example SET(''Foo'', ''Bar'', ''Baz'', ''Bob'')\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/set-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/set-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (88, 22, 'TEXT', 'Syntax\n------\n\nTEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nIf you are handling large text data that exceeds the max_allowed_packet limit, you can stream the data in chunks using specialized API functions like mysql_stmt_send_long_data() or setCharacterStream(). See Handling Large Data via APIs for more details.\n\nA TEXT column with a maximum length of 65,535 (2¹⁶ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each TEXT value is stored using a two-byte length prefix that indicates the number of bytes in the value. If you need a bigger storage, consider using MEDIUMTEXT instead.\n\nAn optional length M can be given for this type. If this is done, MariaDB creates the column as the smallest TEXT type large enough to hold valuesM characters long.\n\nBLOB and TEXT columns can be assigned a DEFAULT value.\n\nExamples\n--------\n\nCREATE TABLE strtest (d TEXT(10));\nINSERT INTO strtest VALUES(''Maria   '');\n\nSELECT d=''Maria'',d=''Maria   '' FROM strtest;\n+-----------+--------------+\n| d=''Maria'' | d=''Maria   '' |\n+-----------+--------------+\n|         1 |            1 |\n+-----------+--------------+\n\nSELECT d LIKE ''Maria'',d LIKE ''Maria   '' FROM strtest;\n+----------------+-------------------+\n| d LIKE ''Maria'' | d LIKE ''Maria   '' |\n+----------------+-------------------+\n|              0 |                 1 |\n+----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/text', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/text');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (89, 22, 'TINYBLOB', 'Syntax\n------\n\nTINYBLOB\n\nDescription\n-----------\n\nA BLOB column with a maximum length of 255 (2⁸ - 1) bytes. Each TINYBLOB value is stored using a one-byte length prefix that indicates the number of bytes in the value.\n\nExamples\n--------\n\nCREATE TABLE tinyblob_example (\n   description VARCHAR(20),\n   example TINYBLOB\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/tinyblob', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/tinyblob');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (90, 22, 'TINYTEXT', 'Syntax\n------\n\nTINYTEXT [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA TEXT column with a maximum length of 255 (2⁸ - 1) characters. The effective maximum length is less if the value contains multi-byte characters. Each TINYTEXT value is stored using a one-byte length prefix that indicates the number of bytes in the value.\n\nExamples\n--------\n\nCREATE TABLE tinytext_example (\n   description VARCHAR(20),\n   example TINYTEXT\n) DEFAULT CHARSET=latin1; -- One byte per char makes the examples clearer\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/tinytext', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/tinytext');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (91, 22, 'UUID Data Type', 'Syntax\n------\n\nUUID\n\nDescription\n-----------\n\nThe UUID data type is intended for the storage of 128-bit UUID (Universally Unique Identifier) data. See the UUID function page for more details on UUIDs themselves.\n\nRetrieval\n\nData retrieved by this data type is in the string representation defined in RFC4122.\n\nCasting\n\nString literals of hexadecimal characters and CHAR/VARCHAR/TEXT can be cast to the UUID data type. Likewise hexadecimal literals, binary-literals, and BINARY/VARBINARY/BLOB types can also be cast to UUID.\n\nThe data type will not accept a short UUID generated with the UUID_SHORT function, but will accept a value without the - character generated by the SYS_GUID function (or inserted directly). Hyphens can be partially omitted as well, or included after any group of two digits.\n\nThe type does not accept UUID values in braces, permitted by some implementations.\n\nStorage\n\nUUID values are stored in an index-friendly manner; the order of a UUID of llllllll-mmmm-Vhhh-vsss-nnnnnnnnnnnn is stored as:\n\n``sql\nnnnnnnnnnnnn-vsss-Vhhh-mmmm-llllllll\n`\n\nThis provides a sorting order, assuming a UUIDv1 (node and timestamp) is used, of the node, followed by the timestamp. The key aspect is the timestamps are sequential.\n\nMariaDB starting with 10.10\n\nTaking into account that UUIDv7 and other versions are designed around time ordering, UUID values version >= 6 are stored without byte-swapping, and UUID values with version >=8 and variant=0 are now considered invalid (as the SQL standard suggests).\n\nUUID values version >= 6 are not stored without byte-swapping, and UUID` values with version >=8 and variant=0 are not considered invalid.\n\nExamples\n--------\n\nCREATE TABLE t1 (id UUID);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/uuid-data-type', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/uuid-data-type');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (92, 22, 'VARBINARY', 'Syntax\n------\n\nVARBINARY(M)\n\nDescription\n-----------\n\nThe VARBINARY type is similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings. M represents the maximum column length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the numeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the extra characters will be dropped with a warning. If strict mode is enabled, an error will occur.\n\nUnlike BINARY values, VARBINARY values are not right-padded when inserting.\n\nUse Cases for Zero Length\n\nA BINARY(0) or VARBINARY(0) column is restricted to an empty byte string or NULL.\n\n Schema Preservation: Use these columns when a system expects a specific column to exist, but no data storage is required for your current application.\n Space-Efficient Indicators: These columns can act as a two-state indicator where the presence of an empty byte string represents one state and NULL represents another.\n\nIf you attempt to insert a value other than an empty string, MariaDB returns an ERROR 1406 (22001) indicating the data is too long for the column.\n\nOracle Mode\n\nIn Oracle mode, RAW is a synonym for VARBINARY.\n\nExamples\n--------\n\nCREATE TABLE varbins (a VARBINARY(10));\n\nINSERT INTO varbins VALUES(''12345678901'');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM varbins;\n+------------+\n| a          |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode=''STRICT_ALL_TABLES'';\n\nINSERT INTO varbins VALUES(''12345678901'');\nERROR 1406 (22001): Data too long for column ''a'' at row 1\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varbinary');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (93, 22, 'VARCHAR', 'Syntax\n------\n\n[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,532. The effective maximum length of a VARCHAR is subject to the maximum row size and the character set used. For example, utf-8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf-8 character set can be declared to be a maximum of 21,844 characters.\n\nVARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the standard SQL way to define that a VARCHAR column should use some predefined character set. MariaDB uses utf-8 as its\\\npredefined character set, as does MySQL. NVARCHAR is shorthand for NATIONAL VARCHAR.\n\nMariaDB stores VARCHAR values as a one-byte or two-byte length prefix plus data. The length prefix indicates the number of bytes in the value. A VARCHAR column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.\n\nMariaDB follows the standard SQL specification and does not remove trailing spaces from VARCHAR values.\n\nIf a unique index consists of a column where trailing pad characters are stripped or ignored, inserts into that column where values differ only by the number of trailing pad characters will result in a duplicate-key error.\n\nFor the ColumnStore engine, M represents the maximum column length in bytes.\n\nFor MariaDB, a number of NO PAD collations are available.\n\nVARCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns cannot be part of an index. The CONNECT storage engine does not support VARCHAR(0).\n\nUse Cases for Zero Length\n\nA CHAR(0) or VARCHAR(0) column occupies minimal space and is restricted to two possible values: an empty string ('''') or NULL. You can use these columns for the following purposes:\n\n Legacy Compatibility: Include these columns to maintain compatibility with older applications that require a specific table schema, even if the data is no longer collected.\n Two-State Flags: A CHAR(0) NULL column can function as a boolean indicator. It uses only one bit of storage to distinguish between a "set" state (the empty string) and an "unset" state (NULL).\n Row Marking: You can use a CHAR(0) column to mark a specific row in a table. For example, if you require only one "active" row, set that row to an empty string while keeping all other rows NULL.\n\nThe following error occurs if you attempt to insert any character data into a 0-length column: ERROR 1406 (22001): Data too long for column.\n\nSYNONYMS\n\nThe following are synonyms for VARCHAR:\n\n CHAR VARYING\n CHARACTER VARYING\n VARCHAR2\n* VARCHARACTER\n\nExamples\n--------\n\nVARCHAR(30) CHARACTER SET utf8\nNATIONAL VARCHAR(30)\nNVARCHAR(30)\nNCHAR VARCHAR(30)\nNATIONAL CHARACTER VARYING(30)\nNATIONAL CHAR VARYING(30)\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (94, 22, 'VARCHAR2', 'Description\n-----------\n\nThis is a synonym for VARCHAR.\n\nExamples\n--------\n\nSET sql_mode=''oracle'';\n\nCREATE TABLE varchar2_example (\n  example VARCHAR2(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar2', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar2');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (95, 22, 'VARCHARACTER', 'Description\n-----------\n\nSee VARCHAR.\n\nExamples\n--------\n\nCREATE TABLE varcharacter_example (\n  example VARCHARACTER(32)\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/varcharacter', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/varcharacter');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (96, 22, 'XMLTYPE', 'Description\n-----------\n\nXMLTYPE is a data type introduced in MariaDB 12.3 for storing XML data. It is designed to:\n\n Provide convenient storage of XML data\n Ensure compatibility with Oracle databases\n Support future XML validation and processing capabilities\n\nIn its initial implementatio&#x6E;_,_ XMLTYPE provides basic XML storage capabilities onl&#x79;_,_ without validation or specialized XML-specific functionalit&#x79;_._ When using string functions, the data type is effectively converted to strings and is maintained in temporary tables.\n\nCharacteristics\n\n Maximum storage capacity: 4GB (same as LONGBLOB)\n Compatibilit&#x79;: Designed to be compatible with Oracle’s XMLTYPE\n Validatio&#x6E;: XML validation or schema enforcement is not supported\n Length restrictio&#x6E;: Length cannot be specified.\n\nExample (invalid usage):\n\n``\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nXMLTYPE does not accept length parameters, unlike data types such as VARCHAR(255) or DECIMAL(10,2)_._\n\nRelated Functions\n\nWith MariaDB 12.3, the following functions return the XMLTYPE data type:\n\n UPDATEXML&#x20;\n CAST&#x20;\n\nExamples\n\nBasic Tables Creation\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nCharacter Set Specification\n\n`\nCREATE TABLE t1(id INT, x xmltype  CHARACTER SET utf8mb3) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  id int(11) DEFAULT NULL,\n  x xmltype CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBinary Attribute\n\n`\nCREATE TABLE t1 (a xmltype binary) CHARACTER SET utf8mb4;\nSHOW CREATE TABLE t1;\n`\n\nOutput\n\n`\nTable	Create Table\nt1	CREATE TABLE t1 (\n  a xmltype CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci\n`\n\nBasic Data Insertion and Selection\n\n`\nCREATE TABLE t1(id INT, x xmltype);\nINSERT INTO t1 VALUES (1, ''one''), (2, ''two''), (3, ''three'');\nSELECT  FROM t1;\n`\n\nOutput\n\n`\nid	x\n1	 one\n2	 two\n3	 three\n`\n\nRestrictions and Error Cases\n\nLength Specification Not Permitted\n\nIf a length parameter is provided for XMLTYPE_,_ the system returns an error:\n\n`\nCREATE TABLE t1 (a XMLTYPE(6));\n`\n\nOutput\n\n`\nERROR HY000: Data type ''XMLTYPE'' doesn''t support LENGTH attribute.\n`\n\nREF_SYSTEM_ID Attribute Not Supported\n\n`\nCREATE TABLE t1 (a XMLTYPE REF_SYSTEM_ID=4);\n`\n\nOutput\n\n`\nERROR HY000: Data type ''XMLTYPE'' doesn''t support REF_SYSTEM_ID attribute.\n\n`\n\nLength Parameters in Complex Column Definitions\n\n`\nCREATE TABLE t1(id INT, x xmltype(10, 2));\n`\n\nOutput\n\n`\nERROR HY000: Data type ''xmltype'' doesn''t support LENGTH attribute.\n``\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/xmltype', '', 'https://mariadb.com/docs/server/reference/data-types/string-data-types/xmltype');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (97, 22, 'TYPE OF', 'Description\n-----------\n\nThis is special declaration only available inside a stored procedure.\n\nExamples\n--------\n\nCREATE TABLE typeof_table(\n  descr VARCHAR(20),\n  val INT\n);\n\nURL: https://mariadb.com/docs/server/reference/data-types/type-of', '', 'https://mariadb.com/docs/server/reference/data-types/type-of');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (98, 35, 'Options, System & Status Variables', 'Description\n-----------\n\n -a (--ansii)\n --abort-slave-event-count\n Aborted_clients\n Aborted_connects\n Aborted_connects_preauth\n Access_denied_errors\n Acl_column_grants\n Acl_database_grants\n Acl_function_grants\n Acl_package_body_grants\n Acl_package_spec_grants\n Acl_procedure_grants\n Acl_proxy_users\n Acl_role_grants\n Acl_roles\n Acl_table_grants\n Acl_users\n \\--allow-suspicious-udfs, allow_suspicious_udfs\n alter_algorithm\n analyze_max_length\n analyze_sample_percentage\n \\--ansii\n aria_block_size\n aria_checkpoint_interval\n aria_checkpoint_log_activity\n aria_encrypt_tables\n aria_force_start_after_recovery_failures\n aria_group_commit\n aria_group_commit_interval\n aria_log_dir_path\n aria_log_file_size\n aria_log_purge_type\n aria_max_sort_file_size\n aria_page_checksum\n aria_pagecache_age_threshold\n aria_pagecache_blocks_not_flushed\n aria_pagecache_blocks_unused\n aria_pagecache_blocks_used\n aria_pagecache_buffer_size\n aria_pagecache_division_limit\n aria_pagecache_file_hash_size\n aria_pagecache_read_requests\n aria_pagecache_reads\n aria_pagecache_segments\n aria_pagecache_write_requests\n aria_pagecache_writes\n aria_recover\n aria_recover_options\n aria_repair_threads\n aria_sort_buffer_size\n aria_stats_method\n aria_sync_log_dir\n aria_transaction_log_syncs\n aria_used_for_temp_tables\n autocommit\n auto_increment_increment\n auto_increment_offset\n automatic_sp_privileges\n aws_key_management_key_spec\n aws_key_management_log_level\n aws_key_management_master_key_id\n aws_key_management_mock\n aws_key_management_region\n aws_key_management_request_timeout\n aws_key_management_rotate_key\n back_log\n -b, basedir\n big_tables\n bind_address\n binlog_alter_two_phase\n binlog_annotate_row_events\n Binlog_bytes_written\n Binlog_cache_disk_use\n binlog_cache_size\n Binlog_cache_use\n binlog_checksum\n binlog_commit_wait_count\n binlog_commit_wait_usec\n Binlog_commits\n binlog_direct_non_transactional_updates\n Binlog_disk_use\n --binlog-do-db, binlog_do_db\n binlog_expire_logs_seconds\n binlog_file_cache_size\n binlog_format\n Binlog_group_commits\n Binlog_group_commit_trigger_count\n Binlog_group_commit_trigger_lock_wait\n Binlog_group_commit_trigger_timeout\n binlog_gtid_index\n Binlog_gtid_index_hit\n Binlog_gtid_index_miss\n binlog_gtid_index_page_size\n binlog_gtid_index_span_min\n \\--binlog-ignore-db, binlog_ignore_db\n binlog_large_commit_threshold\n binlog_legacy_event_pos\n binlog_optimize_thread_scheduling\n binlog_row_image\n \\--binlog-row-event-max-size, binlog_row_event_max_size\n binlog_row_metadata\n Binlog_snapshot_file\n Binlog_snapshot_position\n binlog_space_limit\n Binlog_stmt_cache_disk_use\n Binlog_stmt_cache_use\n binlog_stmt_cache_size\n block_encryption_mode\n \\--bootstrap\n bulk_insert_buffer_size\n Busy_time\n Bytes_received\n Bytes_sent\n cassandra_default_thrift_host\n cassandra_failure_retries\n cassandra_insert_batch_size\n cassandra_multiget_batch_size\n Cassandra_multiget_keys_scanned\n Cassandra_multiget_reads\n Cassandra_multiget_rows_read\n Cassandra_network_exceptions\n cassandra_read_consistency\n cassandra_rnd_batch_size\n Cassandra_row_inserts\n Cassandra_row_insert_batches\n Cassandra_timeout_exceptions\n Cassandra_unavailable_exceptions\n cassandra_write_consistency\n character_set_client\n \\--character-set-client-handshake\n character_set_collations\n character_set_connection\n character_set_database\n character_set_filesystem\n character_set_results\n -C, character_set_server\n character_set_system\n character_sets_dir\n check_constraint_checks\n -r, --chroot\n collation_connection\n collation_database\n collation_server\n Column_compressions\n column_compression_threshold\n column_compression_zlib_level\n column_compression_zlib_strategy\n column_compression_zlib_wrap\n Column_decompressions\n Com_admin_commands\n Com_alter_db\n Com_alter_db_upgrade\n Com_alter_event\n Com_alter_function\n Com_alter_procedure\n Com_alter_sequence\n Com_alter_server\n Com_alter_table\n Com_alter_tablespace\n Com_alter_user\n Com_analyze\n Com_assign_to_keycache\n Com_backup\n Com_backup_lock\n Com_backup_table\n Com_begin\n Com_binlog\n Com_call_procedure\n Com_change_db\n Com_change_master\n Com_check\n Com_checksum\n Com_commit\n Com_compound_sql\n Com_create_db\n Com_create_event\n Com_create_function\n Com_create_index\n Com_create_package\n Com_create_package_body\n Com_create_procedure\n Com_create_role\n Com_create_sequence\n Com_create_server\n Com_create_table\n Com_create_temporary_table\n Com_create_trigger\n Com_create_udf\n Com_create_user\n Com_create_view\n Com_dealloc_sql\n Com_delete\n Com_delete_multi\n Com_do\n Com_drop_db\n Com_drop_event\n Com_drop_function\n Com_drop_index\n Com_drop_package\n Com_drop_package_body\n Com_drop_procedure\n Com_drop_role\n Com_drop_sequence\n Com_drop_server\n Com_drop_table\n Com_drop_temporary_table\n Com_drop_trigger\n Com_drop_user\n Com_drop_user\n Com_drop_view\n Com_empty_query\n Com_execute_immediate\n Com_execute_sql\n Com_flush\n Com_get_diagnostics\n Com_grant\n Com_grant_role\n Com_ha_close\n Com_ha_open\n Com_ha_read\n Com_help\n Com_insert\n Com_insert_select\n Com_install_plugin\n Com_kill\n Com_load\n Com_load_master_data\n Com_load_master_table\n Com_lock_tables\n Com_multi\n Com_optimize\n Com_preload_keys\n Com_prepare_sql\n Com_purge\n Com_purge_before_date\n Com_release_savepoint\n Com_rename_table\n Com_rename_user\n Com_repair\n Com_replace\n Com_replace_select\n Com_reset\n Com_resignal\n Com_restore_table\n Com_revoke\n Com_revoke_all\n Com_revoke_grant\n Com_rollback\n Com_rollback_to_savepoint\n Com_savepoint\n Com_select\n Com_set_option\n Com_show_authors\n Com_show_binlog_events\n Com_show_binlogs\n Com_show_charsets\n Com_show_client_statistics\n Com_show_collations\n Com_show_column_types\n Com_show_contributors\n Com_show_create_db\n Com_show_create_event\n Com_show_create_func\n Com_show_create_package\n Com_show_create_package_body\n Com_show_create_proc\n Com_show_create_table\n Com_show_create_trigger\n Com_show_create_user\n Com_show_databases\n Com_show_engine_logs\n Com_show_engine_mutex\n Com_show_engine_status\n Com_show_events\n Com_show_errors\n Com_show_explain\n Com_show_fields\n Com_show_function_status\n Com_show_generic\n Com_show_grants\n Com_show_keys\n Com_show_index_statistics\n Com_show_binlog_status\n Com_show_master_status\n Com_show_new_master\n Com_show_open_tables\n Com_show_package_status\n Com_show_package_body_status\n Com_show_plugins\n Com_show_privileges\n Com_show_procedure_status\n Com_show_processlist\n Com_show_profile\n Com_show_profiles\n Com_show_relaylog_events\n Com_show_slave_hosts\n Com_show_slave_status\n Com_show_status\n Com_show_storage_engines\n Com_show_table_statistics\n Com_show_table_status\n Com_show_tables\n Com_show_triggers\n Com_show_user_statistics\n Com_show_variable\n Com_show_warnings\n Com_shutdown\n Com_signal\n Com_slave_start\n Com_slave_stop\n Com_start_all_slaves\n Com_start_slave\n Com_stop_all_slaves\n Com_stop_slave\n Com_stmt_close\n Com_stmt_execute\n Com_stmt_fetch\n Com_stmt_prepare\n Com_stmt_reprepare\n Com_stmt_reset\n Com_stmt_send_long_data\n Com_truncate\n Com_uninstall_plugin\n Com_unlock_tables\n Com_update\n Com_update_multi\n Com_xa_commit\n Com_xa_end\n Com_xa_prepare\n Com_xa_recover\n Com_xa_rollback\n Com_xa_start\n completion_type\n Compression\n concurrent_insert\n connect_class_path\n connect_cond_push\n connect_conv_size\n connect_default_depth\n connect_default_prec\n connect_enable_mongo\n connect_exact_info\n connect_force_bson\n connect_indx_map\n connect_java_wrapper\n connect_json_all_path\n connect_json_grp_size\n connect_json_null\n connect_jvm_path\n connect_timeout\n connect_type_conv\n connect_use_tempfile\n connect_work_size\n connect_xtrace\n Connection_errors_accept\n Connection_errors_internal\n Connection_errors_max_connections\n Connection_errors_peer_address\n Connection_errors_select\n Connection_errors_tcpwrap\n Connections\n --console\n core_file\n Cpu_time\n \\--cracklib-password-check\n cracklib_password_check-dictionary\n create_tmp_table_binlog_formats\n Created_tmp_disk_tables\n Created_tmp_files\n Created_tmp_tables\n -h, datadir\n date_format\n datetime_format\n deadlock_search_depth_long\n deadlock_search_depth_short\n deadlock_timeout_long\n deadlock_timeout_short\n -#, debug\n --debug-assert-if-crashed-table\n --debug-binlog-fsync-sleep\n --debug-crc-break\n --debug-flush\n --debug-no-sync\n debug_no_thread_alarm\n debug_sync\n --debug-sync-timeout\n \\--default-character-set\n default_master_connection\n default_password_lifetime\n default_regex_flags\n default_storage_engine\n default_table_type\n default_tmp_storage_engine\n \\--default-time-zone\n default_week_format\n \\--defaults-extra-file\n \\--defaults-file\n delay_key_write\n Delayed_errors\n delayed_insert_limit\n Delayed_insert_threads\n delayed_insert_timeout\n delayed_queue_size\n Delayed_writes\n Delete_scan\n \\--des-key-file\n disconnect_on_expired_password\n \\--disconnect-slave-event-count\n \\--disks\n div_precision_increment\n Empty_queries\n encrypt_binlog\n encrypt_tmp_disk_tables\n encrypt_tmp_files\n encryption_algorithm\n enforce_storage_engine\n engine_condition_pushdown\n eq_range_index_dive_limit\n error_count\n event_scheduler\n Executed_events\n Executed_triggers\n -T, --exit-info\n expensive_subquery_limit\n expire_logs_days\n explicit_defaults_for_timestamp\n \\--external-locking\n external_user\n extra_max_connections\n extra_port\n Feature_application_time_periods\n Feature_check_constraint\n Feature_custom_aggregate_functions\n Feature_delay_key_write\n Feature_dynamic_columns\n Feature_fulltext\n Feature_gis\n Feature_insert_returning\n Feature_invisible_columns\n Feature_json\n Feature_locale\n Feature_subquery\n Feature_timezone\n Feature_trigger\n Feature_window_functions\n Feature_xml\n \\--feedback\n feedback_http_proxy\n feedback_send_retry_wait\n feedback_send_timeout\n feedback_server_uid\n feedback_url\n feedback_user_info\n file_key_management_encryption_algorithm\n file_key_management_filekey\n file_key_management_filename\n \\--flashback\n flush\n Flush_commands\n flush_time\n foreign_key_checks\n ft_boolean_syntax\n ft_max_word_len\n ft_min_word_len\n ft_query_expansion_limit\n ft_stopword_file\n \\--gdb\n general_log\n general_log_file\n \\--getopt-prefix-matching\n group_concat_max_len\n gssapi_keytab_path\n gssapi_principal_name\n gssapi_mech_name\n gtid_binlog_pos\n gtid_binlog_state\n gtid_cleanup_batch_size\n gtid_current_pos\n gtid_domain_id\n gtid_ignore_duplicates\n gtid_pos_auto_engines\n gtid_seq_no\n gtid_slave_pos\n gtid_strict_mode\n -h, datadir\n Handler_commit\n Handler_delete\n Handler_discover\n Handler_external_lock\n Handler_icp_attempts\n Handler_icp_match\n Handler_mrr_init\n Handler_mrr_key_refills\n Handler_mrr_rowid_refills\n Handler_prepare\n Handler_read_first\n Handler_read_key\n Handler_read_last\n Handler_read_next\n Handler_read_prev\n Handler_read_retry\n Handler_read_rnd\n Handler_read_rnd_deleted\n Handler_read_rnd_next\n Handler_rollback\n Handler_savepoint\n Handler_savepoint_rollback\n Handler_tmp_delete\n Handler_tmp_update\n Handler_tmp_write\n Handler_update\n Handler_write\n handlersocket_accept_balance\n handlersocket_address\n handlersocket_backlog\n handlersocket_epoll\n handlersocket_plain_secret\n handlersocket_plain_secret_wr\n handlersocket_port\n handlersocket_port_wr\n handlersocket_rcvbuf\n handlersocket_readsize\n handlersocket_sndbuf\n handlersocket_threads\n handlersocket_threads_wr\n handlersocket_timeout\n handlersocket_verbose\n handlersocket_wrlock_timeout\n hashicorp-key-management-cache-timeout\n hashicorp-key-management-cache-version-timeout\n hashicorp-key-management-caching-enabled\n hashicorp-key-management-check-kv-version\n hashicorp-key-management-max-retries\n hashicorp-key-management-timeout\n hashicorp-key-management-token\n hashicorp-key-management-use-cache-on-timeout\n hashicorp-key-management-vault-ca\n hashicorp-key-management-vault-url\n have_compress\n have_crypt\n have_csv\n have_dynamic_loading\n have_geometry\n have_innodb\n have_ndbcluster\n have_openssl\n have_partitioning\n have_profiling\n have_query_cache\n have_rtree_keys\n have_ssl\n have_symlink\n \\--help\n histogram_size\n histogram_type\n host_cache_size\n hostname\n identity\n idle_readonly_transaction_timeout\n idle_transaction_timeout\n idle_write_transaction_timeout\n ignore_db_dirs\n ignore_builtin_innodb\n in_predicate_conversion_threshold\n in_transaction\n init_connect\n init_file\n \\--init-rpl-role\n init_slave\n \\--innodb\n innodb_adaptive_checkpoint\n innodb_adaptive_flushing\n innodb_adaptive_flushing_lwm\n innodb_adaptive_flushing_method\n Innodb_adaptive_hash_cells\n Innodb_adaptive_hash_hash_searches\n Innodb_adaptive_hash_heap_buffers\n innodb_adaptive_hash_index\n innodb_adaptive_hash_index_partitions\n innodb_adaptive_hash_index_parts\n Innodb_adaptive_hash_non_hash_searches\n innodb_adaptive_max_sleep_delay\n innodb_additional_mem_pool_size\n innodb_alter_copy_bulk\n innodb_api_bk_commit_interval\n innodb_api_disable_rowlock\n innodb_api_enable_binlog\n innodb_api_enable_mdl\n innodb_api_trx_level\n Innodb_async_reads_pending\n Innodb_async_reads_queue_size\n Innodb_async_reads_tasks_running\n Innodb_async_reads_total_enqueues\n Innodb_async_reads_total_count\n Innodb_async_reads_wait_slot_sec\n Innodb_async_writes_pending\n Innodb_async_writes_queue_size\n Innodb_async_writes_tasks_running\n Innodb_async_writes_total_enqueues\n Innodb_async_writes_total_count\n Innodb_async_writes_wait_slot_sec\n innodb-auto-lru-dump\n innodb_autoextend_increment\n innodb_autoinc_lock_mode\n Innodb_available_undo_logs\n Innodb_background_log_sync\n innodb_background_scrub_data_check_interval\n innodb_background_scrub_data_compressed\n innodb_background_scrub_data_interval\n innodb_background_scrub_data_uncompressed\n innodb_blocking_buffer_pool_restore\n innodb_buf_dump_status_frequency\n Innodb_buffer_pool_bytes_data\n Innodb_buffer_pool_bytes_dirty\n innodb_buffer_pool_chunk_size\n innodb_buffer_pool_dump_at_shutdown\n innodb_buffer_pool_dump_now\n innodb_buffer_pool_dump_pct\n Innodb_buffer_pool_dump_status\n innodb_buffer_pool_evict\n innodb_buffer_pool_filename\n innodb_buffer_pool_instances\n innodb_buffer_pool_load_abort\n innodb_buffer_pool_load_at_startup\n innodb_buffer_pool_load_now\n Innodb_buffer_pool_load_incomplete\n innodb_buffer_pool_load_pages_abort\n Innodb_buffer_pool_load_status\n Innodb_buffer_pool_pages_data\n Innodb_buffer_pool_pages_dirty\n Innodb_buffer_pool_pages_flushed\n Innodb_buffer_pool_pages_LRU_flushed\n Innodb_buffer_pool_pages_LRU_freed\n Innodb_buffer_pool_pages_free\n Innodb_buffer_pool_pages_made_not_young\n Innodb_buffer_pool_pages_made_young\n Innodb_buffer_pool_pages_misc\n Innodb_buffer_pool_pages_old\n Innodb_buffer_pool_pages_total\n innodb_buffer_pool_populate\n Innodb_buffer_pool_read_ahead\n Innodb_buffer_pool_read_ahead_evicted\n Innodb_buffer_pool_read_ahead_rnd\n Innodb_buffer_pool_read_requests\n Innodb_buffer_pool_reads\n Innodb_buffer_pool_resize_status\n innodb_buffer_pool_restore_at_startup\n innodb_buffer_pool_shm_checksum\n innodb_buffer_pool_shm_key\n innodb_buffer_pool_size\n innodb_buffer_pool_size_auto_min\n innodb_buffer_pool_size_max\n Innodb_buffer_pool_wait_free\n Innodb_buffer_pool_write_requests\n Innodb_buffered_aio_submitted\n innodb_change_buffer_dump\n innodb_change_buffer_max_size\n innodb_change_buffering\n innodb_change_buffering_debug\n Innodb_checkpoint_age\n innodb_checkpoint_age_target\n Innodb_c\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/full-list-of-mariadb-options-system-and-status-variables');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (99, 5, 'Authentication Plugin - caching\\_sha2\\_password', 'Description\n-----------\n\nTo aid migrations MariaDB provides MySQL compatible caching_sha2_password authentication plugin. It allows to move users from MySQL to MariaDB without requiring them to change their passwords. It should be only used for migration, otherwise a more secure and convenient PARSEC plugin is recommended.\n\nInstalling the Plugin\n\nThe caching_sha2_password authentication plugin''s shared library is included in MariaDB packages as the auth_mysql_sha2.so or auth_mysql_sha2.dll shared library on systems where it can be built.\n\nAlthough the plugin''s shared library is distributed with MariaDB, the plugin is not actually installed into MariaDB by default. There are two methods that can be used to install the plugin into MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''auth_mysql_sha2'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_mysql_sha2\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_mysql_sha2'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nUsing the Plugin\n\nTo create a user in MariaDB that was using caching_sha2_password plugin in MySQL, issue this statement:\n\n`sql\nCREATE USER user@host IDENTIFIED WITH caching_sha2_password USING ''authentication_string'';\n`\n\nHere, authentication_string is taken from the mysql.user table for the corresponding user in MySQL installation. Beware that the authentication string for caching_sha2_password in MySQL can contain non-printable characters and copying it from the terminal window will likely not work.\n\nSystem Variables\n\ncaching_sha2_password_private_key_path\n\n Description: A path to the private RSA key used for authentication.\n Command line: --caching-sha2-password-private-key-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: private_key.pem\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_public_key_path\n\n Description: A path to the public RSA key used for authentication.\n Command line: --caching-sha2-password-public-key-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: public_key.pem\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_auto_generate_rsa_keys\n\n Description: Auto generate RSA keys at server startup if key paths are not explicitly set and key files are not present at their default locations.\n Command line: --caching-sha2-password-auto-generate-rsa-keys\n Scope: Global\n Dynamic: No\n Data Type: boolean\n Default Value: ON\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\ncaching_sha2_password_digest_rounds\n\n Description: Number of SHA2 rounds to be performed when computing a password hash.\n Command line: --caching-sha2-password-digest-rounds\n Scope: Global\n Dynamic: No\n Data Type: integer\n Default Value: 5000`\n Introduced: MariaDB 11.4.9, MariaDB 11.8.4\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-caching_sha2_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-caching_sha2_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (100, 5, 'Authentication Plugin - ed25519', 'Description\n-----------\n\nMySQL has used SHA-1 based authentication since version 4.1. The authentication plugin is called mysql_native_password. Over the years as computers became faster, new attacks on SHA-1 were being developed. Nowadays SHA-1 is no longer considered as secure as it was in 2001. That''s why the ed25519 authentication plugin was created.\n\nThe ed25519 authentication plugin uses Elliptic Curve Digital Signature Algorithm (ECDSA) to securely store users'' passwords and to authenticate users. The ed25519 algorithm is the same one that is used by OpenSSH. It is based on the elliptic curve and code created by Daniel J. Bernstein.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed by default with MariaDB, with a file name of auth_ed25519.so (Unix) or auth_ed25519.dll (Windows), the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''auth_ed25519'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_ed25519\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_ed25519'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nYou can create a user account by executing the CREATE USER statement and providing the IDENTIFIED VIA clause followied by the name of the plugin, ed25519, and providing the USING clause followed by the PASSWORD() function, with the plain-text password as an argument:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''secret'');\n`\n\nThe PASSWORD() function and SET PASSWORD statements don''t work with the ed25519 authentication plugin. Instead, you have to use the UDF that comes with the authentication plugin to calculate the password hash:\n\n`sql\nCREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";\n`\n\nNow you can calculate a password hash by executing this query:\n\n`sql\nSELECT ed25519_password("secret");\n+---------------------------------------------+\n| SELECT ed25519_password("secret");          |\n+---------------------------------------------+\n| ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY |\n+---------------------------------------------+\n`\n\nNow you can use it to create the user account using the new password hash. As with any password, you should always use a complex password that isn''t easy to guess. If you don''t, if anyone gets access to the stored passwords in the mysql.user table, they could use rainbow tables to figure out the original password.\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nNote that users require a password in order to be able to connect. It is possible to create users without specifying a password, but they will be unable to connect.\n\nChanging User Passwords\n\nYou can change a user account''s password by executing the SET PASSWORD statement followed by the PASSWORD() function and providing the plain-text password as an argument:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You would have to specify the name of the plugin in the IDENTIFIED VIA clause while providing the plain-text password as an argument to the PASSWORD() function in the USING clause:\n\n`sql\nALTER USER username@hostname IDENTIFIED VIA ed25519 USING PASSWORD(''new_secret'');\n`\n\nThe PASSWORD() function and SET PASSWORD statement did not work with the ed25519 authentication plugin. Instead, you would have to use the UDF that comes with the authentication plugin to calculate the password hash:\n\n`sql\nCREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";\n`\n\nNow you can calculate a password hash by executing this query:\n\n`sql\nSELECT ed25519_password("secret");\n+---------------------------------------------+\n| SELECT ed25519_password("secret");          |\n+---------------------------------------------+\n| ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY |\n+---------------------------------------------+\n`\n\nNow you can change the user account''s password using the new password hash.\n\nYou can change the user account''s password with the ALTER USER statement. You have to specify the name of the plugin in the IDENTIFIED VIA clause, while providing the password hash as the USING clause:\n\n`sql\nALTER USER username@hostname IDENTIFIED VIA ed25519 \n  USING ''ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the ed25519 authentication plugin:\n\n client_ed25519\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the ed25519 authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nclient_ed25519\n\nThe client_ed25519 client authentication plugin hashes and signs the password using the Elliptic Curve Digital Signature Algorithm (ECDSA) before sending it to the server.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports ed25519 authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports ed25519 authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports ed25519 authentication.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports ed25519 authentication.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports ed25519 authentication.\n\nThe connector implemented support for this authentication plugin in a separate NuGet package called MySqlConnector.Authentication.Ed25519. After the package is installed, your application must call Ed25519AuthenticationPlugin.Install to enable it.\n\nOptions\n\ned25519\n\n Description: Controls how the server should treat the plugin when it starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --ed25519=value\n Data Type: enumerated\n Default Value: ON\n Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT`\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-ed25519', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-ed25519');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (101, 5, 'Authentication Plugin - GSSAPI', 'Description\n-----------\n\nThe gssapi authentication plugin allows the user to authenticate with services that use the Generic Security Services Application Program Interface (GSSAPI). Windows has a slightly different but very similar API called Security Support Provider Interface (SSPI). The GSSAPI is a standardized API described in RFC2743 and RFC2744. The client and server negotiate using a standardized protocol described in RFC7546.\n\nOn Windows, this authentication plugin supports Kerberos and NTLM authentication. Windows authentication is supported regardless of whether a domain is used in the environment.\n\nOn Unix systems, the most dominant GSSAPI service is Kerberos). However, it is less commonly used on Unix systems than it is on Windows. Regardless, this authentication plugin also supports Kerberos authentication on Unix.\n\nThe gssapi authentication plugin is most often used for authenticating with Microsoft Active Directory.\n\nThis article gives instructions on configuring the gssapi authentication plugin\\\nfor MariaDB for passwordless login.\n\nInstalling the Plugin''s Package\n\nSince MariaDB 10.11, on Windows, the plugin is included in the server. There is no need for separate installation.\n\nThe gssapi authentication plugin''s shared library is included in MariaDB packages as the auth_gssapi.so or auth_gssapi.dll shared library on systems where it can be built.\n\nInstalling on Linux\n\nThe gssapi authentication plugin is included in binary tarballs on Linux.\n\nInstalling with a Package Manager\n\nThe gssapi authentication plugin can also be installed via a package manager on Linux. In order to do so, your system needs to be configured to install from one of the MariaDB repositories.\n\nYou can configure your package manager to install it from MariaDB Corporation''s MariaDB Package Repository by using the MariaDB Package Repository setup script.\n\nYou can also configure your package manager to install it from MariaDB Foundation''s MariaDB Repository by using the MariaDB Repository Configuration Tool.\n\nInstalling with yum/dnf\n\nOn RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB''s repository using yum or dnf). Starting with RHEL 8 and Fedora 22, yum has been replaced by dnf, which is the next major version of yum. However, yum commands still work on many systems that use dnf:\n\n``bash\nsudo yum install MariaDB-gssapi-server\n`\n\nInstalling with apt-get\n\nOn Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to install the relevant DEB package from MariaDB''s repository using apt-get:\n\n`bash\nsudo apt-get install mariadb-plugin-gssapi-server\n`\n\nInstalling with zypper\n\nOn SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to install the relevant RPM package from MariaDB''s repository using zypper:\n\n`bash\nsudo zypper install MariaDB-gssapi-server\n`\n\nInstalling on Windows\n\nBefore MariaDB 10.11, the gssapi authentication plugin is included in MSI and ZIP packages on Windows.\n\nInstalling the Plugin\n\nSince MariaDB 10.11, on Windows, the plugin is included in the server. There is no need for separate installation.\n\nOn Windows, and on other operating systems, although the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''auth_gssapi'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_gssapi\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_gssapi'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nConfiguring the Plugin\n\nIf the MariaDB server is running on Unix, then some additional configuration steps will need to be implemented in order to use the plugin.\n\nIf the MariaDB server is running on Windows, then no special configuration steps will need to be implemented in order to use the plugin, as long as the following is true:\n\n The Windows server is joined to a domain.\n The MariaDB server process is running as either a NetworkService Account or a Domain User Account.\n\nCreating a Keytab File on Unix\n\nIf the MariaDB server is running on Unix, then the KDC server will need to create a keytab file for the MariaDB server. The keytab file contains the service principal name, which is the identity that the MariaDB server will use to communicate with the KDC server. The keytab will need to be transferred to the MariaDB server, and the mysqld server process will need read access to this keytab file.\n\nHow this keytab file is generated depends on whether the KDC server is Microsoft Active Directory KDC or MIT Kerberos KDC.\n\nCreating a Keytab File with Microsoft Active Directory\n\nIf you are using Microsoft Active Directory KDC, you may need to create a keytab using the ktpass.exe utility on a Windows host. The service principal will need to be mapped to an existing domain user. To do so, follow the steps listed below.\n\nBe sure to replace the following items in the step below:\n\n Replace ${HOST} with the fully qualified DNS name for the MariaDB server host.\n Replace ${DOMAIN} with the Active Directory domain.\n Replace ${AD_USER} with the existing domain user.\n Replace ${PASSWORD} with the password for the service principal.\n\nTo create the service principal, execute the following command:\n\n`bash\nktpass.exe /princ mariadb/${HOST}@${DOMAIN} /mapuser ${AD_USER} /pass ${PASSWORD} /out mariadb.keytab /crypto all /ptype KRB5_NT_PRINCIPAL /mapop set\n`\n\nCreating a Keytab File with MIT Kerberos\n\nIf you are using MIT Kerberos KDC, then you can create a keytab file using the kadmin utility. To do so, follow the steps listed below.\n\nIn the following steps, be sure to replace ${HOST} with the fully qualified DNS name for the MariaDB server host.\n\nFirst, create the service principal using the kadmin utility:\n\n`bash\nkadmin -q "addprinc -randkey mariadb/${HOST}"\n`\n\nThen, export the newly created user to the keytab file using the kadmin utility:\n\n`bash\nkadmin -q "ktadd -k /path/to/mariadb.keytab mariadb/${HOST}"\n`\n\nMore details can be found at the following links:\n\n MIT Kerberos Documentation: Database administration\n MIT Kerberos Documentation: Application servers\n\nConfiguring the Path to the Keytab File on Unix\n\nIf the MariaDB server is running on Unix, then the path to the keytab file that was previously created can be set by configuring the gssapi_keytab_path system variable. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\ngssapi_keytab_path=/path/to/mariadb.keytab\n`\n\nConfiguring the Service Principal Name\n\nThe service principal name can be set by configuring the gssapi_principal_name system variable. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\ngssapi_principal_name=service_principal_name/host.domain.com@REALM\n`\n\nIf a service principal name is not provided, the plugin tries to use mariadb/host.domain.com@REALM by default.\n\nIf the MariaDB server is running on Unix, the plugin needs a service principal name in order to function.\n\nIf the MariaDB server is running on Windows, the plugin does not usually need a service principal in order to function. However, if you want to use one, anyway, it can be created with the setspn utility.\n\nDifferent KDC implementations may use different canonical forms to identify principals. See RFC2744: Section 3.10 to learn what the standard says about principal names.\n\nMore details can be found at the following links:\n\n Active Directory Domain Services: Service Principal Names\n MIT Kerberos Documentation: Realm configuration decisions\n MIT Kerberos Documentation: Principal names and DNS\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA gssapi;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA gssapi;\n`\n\nYou can also specify the user''s realm for MariaDB with the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA gssapi USING ''username@EXAMPLE.COM'';\n`\n\nThe format of the realm depends on the specific authentication mechanism that is used. For example, the format would need to be machine\\\\username for Windows users authenticating with NTLM.\n\nIf the realm is not provided in the user account''s definition, then the realm is not used for comparison. Therefore, ''usr1@EXAMPLE.COM'', ''usr1@EXAMPLE.CO.UK'' and ''mymachine\\usr1'' would all identify as the following user account:\n\n`sql\nCREATE USER usr1@hostname IDENTIFIED VIA gssapi;\n`\n\nCreating Users Identified Via Group Membership or SID (Windows-specific)\n\nOn Windows only, it is possible to login using a AD or local group-membership. This is achieved by using the GROUP prefix in IDENTIFIED ... AS:\n\n`sql\nCREATE USER root IDENTIFIED VIA gssapi AS ''GROUP:Administrators''\nCREATE USER root IDENTIFIED VIA gssapi AS ''GROUP:BUILTIN\\\\Administrators''\n`\n\nThe effect of the above definition is that every user that identifies as a member of group Administrators can log in using the user name root without a password.\n\nUser can also login using own or group SID (Security Identifier):\n\n`sql\nCREATE USER root IDENTIFIED VIA gssapi AS ''SID:S-1-5-32-544''\n`\n\nUsing SIDs will perform slightly faster than using name (since it will spare translation between SID and name which is otherwise done). SIDs are immune against user or group renaming.\n\nPasswordless login on Windows\n\nThis feature is available from MariaDB 10.11.\n\nOn Windows, in addition to the usual authentication with a password, passwordless authentication is permitted when creating the root user during installation. This works in a similar manner to Unix socket authentication. However, since auth_gssapi, unlike unix_socket, requires client support, to avoid failures when MariaDB is used with third-party drivers, authentication on Windows first attempts password-based native_authentication, and only if it fails, falls back to passwordless auth_gssapi.\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the gssapi authentication plugin:\n\n auth_gssapi_client\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the gssapi authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nauth_gssapi_client\n\nThe auth_gssapi_client client authentication plugin receives the principal name from the server, and then uses either the gss_init_sec_context function (on Unix) or the InitializeSecurityContext function (on Windows) to establish a security context on the client.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports gssapi authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports gssapi authentication using the client authentication plugins mentioned in the previous section.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports gssapi authentication. Current documentation can be found here.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js does not yet support gssapi authentication. See CONJS-72 for more information.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports gssapi authentication.\n\nThe support is transparent. Normally, the connector only needs to be provided the correct user name, and no other parameters are required.\n\nHowever, this connector also supports the ServerSPN connection string parameter, which can be used for mutual authentication.\n\n.NET specific problems/workarounds\n\nWhen connecting from Unix client to Windows server with ADO.NET, in an Active Directory domain environment, be aware that .NET Core on Unix does not support principal names in UPN(User Principal Name) form, which is default on Windows (e.g machine$@domain.com) . Thus, upon encountering an authentication exception with "server not found in Kerberos database", use one of workarounds below\n\n Force host-based SPN on server side.\n   For example, this can be done by setting the gssapi_principal_name system variable to HOST/machine in a server option group in an option file.\n Pass host-based SPN on client side.\n   For example, this can be done by setting the connector''s ServerSPN connection string parameter to HOST/machine.\n\nSystem Variables\n\ngssapi_keytab_path\n\n Description: Defines the path to the server''s keytab file.\n   This system variable is only meaningful on Unix.\n   See Creating a Keytab File on Unix and Configuring the Path to the Keytab File on Unix for more information.\n Command line: --gssapi-keytab-path\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: ''''\n Introduced: MariaDB 10.1.11\n\ngssapi_principal_name\n\n Description: Name of the service principal.\n   See Configuring the Service Principal Name for more information.\n Command line: --gssapi-principal-name\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: ''''\n Introduced: MariaDB 10.1.11\n\ngssapi_mech_name\n\n Description: Name of the SSPI package used by server. Can be either ''Kerberos'' or ''Negotiate''. Set it to ''Kerberos'', to prevent less secure NTLM in domain environments, but leave it as default (Negotiate) to allow non-domain environments (e.g if server does not run in a domain environment).\n   This system variable is only meaningful on Windows.\n Command line: --gssapi-mech-name\n Scope: Global\n Dynamic: No\n Data Type: enumerated\n Default Value: Negotiate\n Valid Values: Kerberos, Negotiate\n Introduced: MariaDB 10.1.11\n\nOptions\n\ngssapi\n\n Description: Controls how the server should trea\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-gssapi');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (102, 5, 'Authentication Plugin - mysql\\_native\\_password', 'Description\n-----------\n\nThe mysql_native_password authentication plugin is the default authentication plugin that will be used for an account created when no authentication plugin is explicitly mentioned and old_passwords=0 is set. It uses the password hashing algorithm introduced in MySQL 4.1, which is also used by the PASSWORD() function when old_passwords=0 is set. This hashing algorithm is based on SHA-1.\n\nIt is not recommended to use the mysql_native_password authentication plugin for new installations that require high password security. If someone is able to both listen to the connection protocol and get a copy of the mysql.user table, then the person would be able to use this information to connect to the MariaDB server. The ed25519 authentication plugin is a more modern authentication plugin that provides simple password authentication using a more secure algorithm.\n\nInstalling the Plugin\n\nThe mysql_native_password authentication plugin is statically linked into the server, so no installation is necessary.\n\nCreating Users\n\nThe easiest way to create a user account with the mysql_native_password authentication plugin is to make sure that old_passwords=0 is set, and then create a user account via CREATE USER that does not specify an authentication plugin, but does specify a password via the IDENTIFIED BY clause:\n\n``sql\nSET old_passwords=0;\nCREATE USER username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nSET old_passwords=0;\nGRANT SELECT ON db. TO username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nYou can also create the user account by providing a password hash via the IDENTIFIED BY PASSWORD clause, and MariaDB will validate whether the password hash is one that is compatible with mysql_native_password:\n\n`sql\nSET old_passwords=0;\n\nSELECT PASSWORD(''mariadb'');\n+-------------------------------------------+\n| PASSWORD(''mariadb'')                       |\n+-------------------------------------------+\n| 54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n\nCREATE USER username@hostname\n  IDENTIFIED BY PASSWORD ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nSimilar to all other authentication plugins, you could also specify the name of the plugin in the IDENTIFIED VIA clause while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname\n  IDENTIFIED VIA mysql_native_password USING ''54958E764CE10E50764C2EECBB71D01F08549980'';\n`\n\nChanging User Passwords\n\nYou can change a user account''s password with the SET PASSWORD statement while providing the plain-text password as an argument to the PASSWORD() function:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You would have to make sure that old_passwords=0 is set, and then you would have to specify a password via the IDENTIFIED BY clause:\n\n`sql\nSET old_passwords=0;\nALTER USER username@hostname IDENTIFIED BY ''new_secret'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the mysql_native_password authentication plugin:\n\n* mysql_native_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the mysql_native_password authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nHowever, the mysql_native_password client authentication plugin is generally statically linked into client libraries like libmysqlclient or MariaDB Connector/C, so this is not usually necessary.\n\nmysql_native_password\n\nThe mysql_native_password client authentication plugin hashes the password before sending it to the server.\n\nSupport in Client Libraries\n\nThe mysql_native_password authentication plugin is one of the conventional authentication plugins, so all client libraries should support it.\n\nKnown Old Issues (Only Relevant for Old Installations)\n\nMismatches Between Password and authentication_string Columns\n\nFor compatibility reasons, the mysql_native_password authentication plugin tries to read the password hash from both the Password and authentication_string columns in the mysql.user table. This has caused issues in the past if one of the columns had a different value than the other.\n\nCREATE USER, ALTER USER, GRANT, and SET PASSWORD set the Password and authentication_string columns in the mysql.user table whenever an account''s password is changed.\n\nCREATE USER, ALTER USER, GRANT, and SET PASSWORD do not set the Password and authentication_string` columns in the mysql.user table whenever an account''s password is changed.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_native_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_native_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (103, 5, 'Authentication Plugin - mysql\\_old\\_password', 'Description\n-----------\n\nThe mysql_old_password authentication plugin is the default authentication plugin that is used for an account created when no authentication plugin is explicitly mentioned and old_passwords=1 is set. It uses the pre-MySQL 4.1 password hashing algorithm, which is also used by the OLD_PASSWORD() function and by the PASSWORD() function when old_passwords=1 is set.\n\nIt is not recommended to use the mysql_old_password authentication plugin for new installations. The password hashing algorithm is no longer secure, and the plugin is primarily provided for backward compatibility. The ed25519 authentication plugin is a more modern authentication plugin that provides simple password authentication.\n\nInstalling the Plugin\n\nThe mysql_old_password authentication plugin is statically linked into the server, so no installation is necessary.\n\nCreating Users\n\nThe easiest way to create a user account with the mysql_old_password authentication plugin is to make sure that old_passwords=1 is set, and create a user account via CREATE USER that does not specify an authentication plugin, but instead specifies a password via the IDENTIFIED BY clause:\n\n``sql\nSET old_passwords=1;\nCREATE USER username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user via GRANT:\n\n`sql\nSET old_passwords=1;\nGRANT SELECT ON db. TO username@hostname IDENTIFIED BY ''mariadb'';\n`\n\nYou can also create the user account by providing a password hash via the IDENTIFIED BY PASSWORD clause, and MariaDB validates whether the password hash is one that is compatible with mysql_old_password:\n\n`sql\nSET old_passwords=1;\nQuery OK, 0 rows affected (0.000 sec)\n\nSELECT PASSWORD(''mariadb'');\n+---------------------+\n| PASSWORD(''mariadb'') |\n+---------------------+\n| 021bec665bf663f1    |\n+---------------------+\n1 row in set (0.000 sec)\n\nCREATE USER username@hostname IDENTIFIED BY PASSWORD ''021bec665bf663f1'';\nQuery OK, 0 rows affected (0.000 sec)\n`\n\nSimilar to all other authentication plugins, you could also specify the name of the plugin in the IDENTIFIED VIA clause, while providing the password hash as the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA mysql_old_password USING ''021bec665bf663f1'';\nQuery OK, 0 rows affected (0.000 sec)\n`\n\nChanging User Passwords\n\nYou can change a user account''s password with the SET PASSWORD statement, while providing the plain-text password as an argument to the PASSWORD() function:\n\n`sql\nSET PASSWORD =  PASSWORD(''new_secret'')\n`\n\nYou can also change the user account''s password with the ALTER USER statement. You have to make sure that old_passwords=1 is set, and you have to specify a password via the IDENTIFIED BY clause:\n\n`sql\nSET old_passwords=1;\nALTER USER username@hostname IDENTIFIED BY ''new_secret'';\n`\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides one client authentication plugin that is compatible with the mysql_old_password authentication plugin:\n\n mysql_old_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the mysql_old_password authentication plugin. You may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nHowever, the mysql_old_password client authentication plugin is generally statically linked into client libraries like libmysqlclient or MariaDB Connector/C, so this is not usually necessary.\n\nmysql_old_password\n\nThe mysql_old_password client authentication plugin hashes the password before sending it to the server.\n\nSupport in Client Libraries\n\nThe mysql_old_password` authentication plugin is one of the conventional authentication plugins, so all client libraries should support it.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_old_password', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-mysql_old_password');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (104, 5, 'Authentication Plugin - Named Pipe', 'Description\n-----------\n\nThe named_pipe authentication plugin allows the user to use operating system credentials when connecting to MariaDB via named pipe on Windows. Named pipe connections are enabled by the named_pipe system variable.\n\nThe named_pipe authentication plugin works by using named pipe impersonation.aspx) and calling GetUserName() to retrieve the user name of the process that is connected to the named pipe. Once it has the user name, it authenticates the connecting user as the MariaDB account that has the same user name.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''auth_named_pipe'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd, or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_named_pipe\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_named_pipe'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA named_pipe;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db.* TO username@hostname IDENTIFIED VIA named_pipe;\n`\n\nClient Authentication Plugins\n\nThe named_pipe authentication plugin does not require any specific client authentication plugins. It should work with all clients.\n\nSupport in Client Libraries\n\nThe named_pipe` authentication plugin does not require any special support in client libraries. It should work with all client libraries.\n\nExamples\n--------\n\nCREATE USER wlad IDENTIFIED VIA named_pipe;\nCREATE USER monty IDENTIFIED VIA named_pipe;\nquit\n\nC:\\>echo %USERNAME%\nwlad\n\nC:\\> mysql --user=wlad --protocol=PIPE\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 4\nServer version: 10.1.12-MariaDB-debug Source distribution\n\nCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> quit\nBye\n\nC:\\> mysql --user=monty  --protocol=PIPE\nERROR 1698 (28000): Access denied for user ''monty''@''localhost''\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-named-pipe', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-named-pipe');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (105, 5, 'Authentication Plugin - PARSEC', 'Description\n-----------\n\n The KDF function is pbkdf2 (supported by everything, including windows native, Java, javascript, PHP, .NET.\n Parameters to the pbkdf2 are stored in with authentication plugin data : hash function (SHA512,SHA256), iteration count, salt, key_length, together with derived key = PBKDF2(func, password, salt, iteration_count, key_length).\n The number of iterations is a power of 2, greater than 9.\n The algorithm is ed25519, "hash" is the public key generated using ed25519 from the PBKDF2(password).\n\nThe authentication string, stored by the server, is this:\n\n``c\nconcat(''P'', conv(log2(iterations)-10, 10, 62), '':'', base64(salt), '':'', base64(hash))\n`\n\nFor example, it looks like this: P0:WW9sXaaL/o:vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI\n\n It consists of colon-separated fields.\n The first field is ''P'' (denotes KDF algorithm = PBKDF2) and the number of iterations, ''0'' means 1024, ''1'' means 2048, etc.\n This is followed by the salt.\n This is followed by the password hash.\n\nThe first two fields together are called _ext-salt_, extended salt.\n\nLogin Process, Packet Exchange\n\n1. The server sends an Authentication Switch Request with a 32-byte random scramble.\n2. The client sends an empty packet to the server to request the ext-salt.\n3. The server sends the ext-salt to the client.\n4. The client sends the random 32-byte scramble, and the concat(server scramble, client scramble) ed25519-signed by a secret key generated from the function PBKDF2(password, ext-salt).\n5. The server replies with "ok" or "access denied".\n\nInstalling\n\nIf you run into the error ERROR 1524 (HY000): Plugin ''parsec'' is not loaded it means you need to install the authentication plugin first. You can do it on a running server with:\n\n`sql\nINSTALL SONAME ''auth_parsec'';\n`\n\nThere is no need to pass additional command-line options or have config files to keep the PARSEC authentication method available. Running the INSTALL SONAME` once is enough and the MariaDB Server will remember it even if server is restarted or upgraded.\n\nExamples\n--------\n\nCREATE USER test1@''%'' IDENTIFIED VIA parsec USING PASSWORD(''pwd'');\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-parsec', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-parsec');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (106, 5, 'Authentication Plugin - SHA-256', 'Description\n-----------\n\nBackground\n\nMySQL 5.6 added support for the sha256_password authentication plugin, and MySQL 8.0 also added support for the caching_sha2_password authentication plugin.\n\nThe caching_sha2_password plugin is now the default authentication plugin in MySQL 8.0.4 and above, based on the value of the default_authentication_plugin system variable.\n\nSupport in MariaDB Server\n\nMariaDB Server does not support the sha256_password plugin. A caching_sha2_password authentication plugin was added in MariaDB Community Server 12.1 and Enterprise Server 11.8. See MDEV-9804 for more information.\n\nReasons for not supporting the SHA-256 plugin:\n\n To use the protocol, you have to distribute the server''s public key to all MariaDB users, which can be cumbersome and impractical.\n The server receives the password in clear text, which can cause problems if the user connects to a malicious server.\n\nIf you are migrating from a MySQL instance that is using SHA-256 authentication, you have to change the SHA-256 authentication to mysql_native_authentication :\n\n``sql\nALTER USER user_name IDENTIFIED WITH mysql_native_password BY ''new_password''\n`\n\nSupport in Client Libraries\n\nClient Authentication Plugins\n\nFor clients that use the MariaDB Connector/C library, MariaDB provides client authentication plugins that are compatible with MySQL''s SHA-256 authentication plugins:\n\n sha256_password\n caching_sha256_password\n\nWhen connecting with a client or utility to a server, using a user account that authenticates with the sha256_password or caching_sha256_password authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmysql --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nFor clients that use MariaDB''s libmysqlclient library instead of MariaDB Connector/C, those authentication plugins are not supported.\n\nsha256_password\n\nThe sha256_password client authentication plugin is compatible with MySQL''s sha256_password authentication plugin, which was added in MySQL 5.6.\n\ncaching_sha256_password\n\nThe caching_sha256_password client authentication plugin is compatible with MySQL''s caching_sha2_password authentication plugin, which was added in MySQL 8.0.\n\nThe caching_sha2_password plugin is now the default authentication plugin in MySQL 8.0.4 and above, based on the value of the default_authentication_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports sha256_password and caching_sha2_password authentication using the client authentication plugins mentioned in the previous section.\n\nIt has supported the sha256_password client authentication plugin since MariaDB Connector/C 3.0.2. See CONC-229 for more information.\n\nIt has supported the caching_sha256_password client authentication plugin since MariaDB Connector/C 3.0.8 and MariaDB Connector/C 3.1.0. See CONC-312 for more information.\n\nUsing Plugins with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports sha256_password and caching_sha2_password authentication using the client authentication plugins mentioned in the previous section.\n\nIt has supported sha256_password and caching_sha2_password authentication since MariaDB Connector/ODBC 3.1.4. See ODBC-241 for more information.\n\nUsing Plugins with MariaDB Connector/J\n\nMariaDB Connector/J supports sha256_password and caching_sha2_password authentication since MariaDB Connector/J 2.5.0. See CONJ-327 and CONJ-663 for more information.\n\nnote: The version 3.x being a rewrite of the connector, only caching_sha2_password is implemented, since sha256_password is only implemented on EOL version.\n\nUsing Plugins with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports sha256_password and caching_sha2_password` authentication since MariaDB Connector/Node.js 2.5.0. See CONJS-76 and CONJS-77 for more information.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-sha-256', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-sha-256');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (107, 5, 'Authentication Plugin - Unix Socket', 'Description\n-----------\n\nThe unix_socket authentication plugin is installed by default, and it is used by the ''root''@''localhost'' user account by default. See Authentication for more information.\n\nThe unix_socket authentication plugin allows the user to use operating system credentials when connecting to MariaDB via the local Unix socket file. This Unix socket file is defined by the socket system variable.\n\nThe unix_socket authentication plugin works by calling the getsockopt system call with the SO_PEERCRED socket option, which allows it to retrieve the uid of the process that is connected to the socket. It is then able to get the user name associated with that uid. Once it has the user name, it will authenticate the connecting user as the MariaDB account that has the same user name.\n\nThe unix_socket authentication plugin is not suited to multiple Unix users accessing a single MariaDB user account.\n\nSecurity\n\nA unix_socket authentication plugin is a passwordless security mechanism. Its security lies in the strength of the access to the Unix user, rather than the complexity and the secrecy of the password.\n\nAs security differs from password security, the strengths and weaknesses need to be considered, and those can differ depending on the specific installation.\n\nStrengths\n\n Access is limited to the Unix user so, for example, a www-data user cannot access root with the unix_socket authentication plugin.\n There is no password which can be cracked by brute force.\n There is no password that can be accidentally exposed by user accident, poor security on backups, or poor security on passwords in configuration files.\n Default Unix user security is usually strong on preventing remote access and password brute force attempts.\n\nWeaknesses\n\nThe strength of a unix_socket authentication plugin is effectively the strength of the security of the Unix users on the system. In most cases, the Unix user default installation is sufficiently secure. However, the following is a non-exhaustive list of potential Unix user security issues that may arise.\n\n Common access areas without screen locks, where an unauthorized user accesses the logged in Unix user of an authorized user.\n Extensive sudo access grants that provide users with access to execute commands of a different Unix user.\n Scripts writable by Unix users other than the Unix user that are executed (via cron or directly) by the Unix user.\n Web pages that are susceptible to command injection, where the Unix user running the web page has elevated privileges in the database that weren''t intended to be used.\n Poor Unix user password practices including weak user passwords, password exposure and password reuse accompanied by an access vulnerability/mechanism of an unauthorized user to exploit this weakness.\n Weak remote access mechanisms and network file system privileges.\n Poor user security behavior including running untrusted scripts and software.\n\nIn some of these scenarios a database password may prevent these security exploits, however it will remove all the strengths of the unix_socket authentication plugin previously mentioned.\n\nDisabling the Plugin\n\nThe unix_socket authentication plugin is installed by default.\n\nIf you do not want it to be available by default, you must disable it.\n\nThe unix_socket authentication plugin is also installed by default in new installations that use the .deb packages provided by Debian''s default repositories and Ubuntu''s default repositories. See Differences in MariaDB in Debian (and Ubuntu) for more information.\n\nThe unix_socket authentication plugin can be disabled by starting the server with the unix_socket option set to OFF. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n``ini\n[mariadb]\n...\nunix_socket=OFF\n`\n\nAs an alternative, the unix_socket option can also be set to OFF by pairing the option with the disable option prefix:\n\n`ini\n[mariadb]\n...\ndisable_unix_socket\n`\n\nInstalling the Plugin\n\nThe unix_socket authentication plugin is installed by default in almost all MariaDB server versions. If you work with a version that doesn''t have the plugin installed, you can install it as described in one of the following ways.\n\n Install the plugin without restarting the server. You can install the plugin dynamically, by executing INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''auth_socket'';\n`\n\n Instruct the server to load the plugin at startup. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_socket\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_socket'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a server option group in an option file, those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nCreating Users\n\nTo create a user account via CREATE USER, specify the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA unix_socket;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user account via GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA unix_socket;\n`\n\nThe authentication string (if present) is compared with the socket''s user name. Authentication proceeds if there''s a match. In this case, the external_user system variable contains the OS user.\n\nConsider an OS user named ''bob'' that has been created like this:\n\n`sql\nCREATE USER A identified via unix_socket as ''bob'';\n\n`\n\nThat user can connect like this:\n\n`bash\nmariadb -uA\n`\n\nAlternatively, accessing the sock file directly, the user can connect like this:\n\n`bash\nmariadb -uA -S /var/run/mysqld/mysqld.sock\n`\n\nOnce connected, you can view that user like this:\n\n`sql\nSELECT USER(),@@external_user;\n+-------------+-----------------+\n| user()      | @@external_user |\n+-------------+-----------------+\n| A@localhost | bob             |\n+-------------+-----------------+\n`\n\nThe plugin only checks whether the OS socket user id matches the MariaDB user name. It ignores the authentication string.\n\nSwitching to Password-Based Authentication\n\nIf Unix socket authentication does not meet your needs, you can switch a user account back to password-based authentication, by telling MariaDB to use a different authentication plugin for the account. The specific authentication plugin is specified with the IDENTIFIED VIA clause. To switch to the mysql_native_password authentication plugin, you need to do this:\n\n`sql\nALTER USER root@localhost IDENTIFIED VIA mysql_native_password;\nSET PASSWORD = PASSWORD(''foo'');\n`\n\nIf you use scripts that require passwordless access to MariaDB, this would cause them to break. You may be able to fix that by setting a password in the [client] option group in your /root/.my.cnf option file.\n\n`ini\n[client]\npassword=foo\n`\n\nClient Authentication Plugins\n\nThe unix_socket authentication plugin does not require any specific client authentication plugins. It should work with all clients.\n\nSupport in Client Libraries\n\nThe unix_socket` authentication plugin does not require any special support in client libraries. It should work with all client libraries.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-unix-socket', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-plugin-unix-socket');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (108, 5, 'Authentication Plugin - PAM', 'Description\n-----------\n\nThe pam authentication plugin allows MariaDB to offload user authentication to the system''s Pluggable Authentication Module (PAM) framework. PAM is an authentication framework used by Linux, FreeBSD, Solaris, and other Unix-like operating systems.\n\nNote: Windows does not support PAM, so the pam authentication plugin does not support Windows. However, one can use a MariaDB client on Windows to connect to MariaDB server that is installed on a Unix-like operating system and that is configured to use the pam authentication plugin. For an example of how to do this, see the blog post: MariaDB: Improve Security with Two-Step Verification.\n\nUse Cases\n\nPAM makes it possible to implement various authentication scenarios of different complexity:\n\n Authentication using passwords from /etc/shadow (this is what a default PAM configuration usually does). See the pam_unix PAM module.\n Authentication using LDAP. See the pam_ldap PAM module.\n Authentication using Microsoft''s Active Directory. See the pam_lsass, pam_winbind, and pam_centrifydc PAM modules.\n Authentication using one-time passwords (even with SMS confirmation!). See the pam_google_authenticator and pam_securid PAM modules.\n Authentication using SSH keys. See the pam_ssh PAM module.\n User and group mapping. See the pam_user_map PAM module.\n Combining different authentication modules in interesting ways in a PAM service.\n Password expiration.\n Limiting access by time, date, day of the week, etc. See the pam_time PAM module.\n Logging of every login attempt.\n\nInstalling the Plugin\n\nThe pam authentication plugin''s library is provided in binary packages in all releases on Linux.\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n``sql\nINSTALL SONAME ''auth_pam'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mysqld or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = auth_pam\n`\n\nInstalling the v1 Plugin\n\nThe auth_pam shared library actually refers to version 2.0 of the pam authentication plugin. Version 1.0 of the plugin as the auth_pam_v1 shared library is also available.\n\nIf you need to install version 1.0 of the authentication plugin instead of version 2.0, install it with INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''auth_pam_v1'';\n`\n\nAlternatively, specify it in a relevant server option group in an option file:\n\n`sql\n[mariadb]\n...\nplugin_load_add = auth_pam_v1\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''auth_pam'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, those options must be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nUninstalling the v1 Plugin\n\nIf you installed version 1.0 of the authentication plugin, you can uninstall it by executing a similar statement for auth_pam_v1:\n\n`sql\nUNINSTALL SONAME ''auth_pam_v1'';\n`\n\nConfiguring PAM\n\nThe pam authentication plugin tells MariaDB to delegate the authentication to the PAM authentication framework. How exactly that authentication is performed depends on how PAM is configured.\n\nConfiguring the PAM Service\n\nPAM is divided into services. PAM services are configured by PAM configuration files. Typically, the global PAM configuration file is located at /etc/pam.conf and PAM directory-based configuration files for individual services are located in /etc/pam.d/.\n\nIf you want to use a PAM service called mariadb for your MariaDB PAM authentication, then the PAM configuration file for that service would also be called mariadb, and it would typically be located at /etc/pam.d/mariadb.\n\nFor example, here is a minimal PAM service configuration file that performs simple password authentication with UNIX passwords:\n\n`\nauth required pam_unix.so audit\naccount required pam_unix.so audit\n`\n\nLet''s breakdown this relatively simple PAM service configuration file.\n\nEach line of a PAM service configuration file has the following general format:\n\n`\ntype control module-path module-arguments\n`\n\nIt instructs the PAM authentication framework that for successful authentication (i.e. type=auth), it is required that the pam_unix.so PAM module returns a success. It also instructs the PAM authentication framework that for an account (i.e. type=account) to be valid, it is required that the pam_unix.so PAM module returns a success.\n\nPAM also supports session and password types, but MariaDB''s pam authentication plugin does not support those.\n\nThe above PAM service configuration file also provides the audit module argument to the pam_unix PAM module. The pam_unix manual says that this module argument enables extreme debug logging to the syslog.\n\nOn most systems, you can find many other examples of PAM service configuration files in your /etc/pam.d/ directory.\n\nConfiguring the pam_unix PAM Module\n\nIf you configure PAM to use the pam_unix PAM module (as in the above example), then you might notice on some systems that this will fail by default with errors like the following:\n\n`\nApr 14 12:56:23 localhost unix_chkpwd[3332]: check pass; user unknown\nApr 14 12:56:23 localhost unix_chkpwd[3332]: password check failed for user (alice)\nApr 14 12:56:23 localhost mysqld: pam_unix(mysql:auth): authentication failure; logname= uid=991 euid=991 tty= ruser= rhost=  user=alice\n`\n\nThe problem is that on some systems, the pam_unix PAM module needs access to /etc/shadow in order to function, and most systems only allow root to access that file by default.\n\nNewer versions of PAM do not have this limitation, so you may want to try upgrading your version of PAM to see if that fixes the issue.\n\nIf that does not work, then you can work around this problem by giving the user that runs mysqld access to /etc/shadow. For example, if the mysql user runs mysqld, then you could do the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nAfter configuring, you have to restart the server. The server should now be able to read /etc/shadow.\n\nThe pam authentication plugin uses a setuid wrapper to perform its PAM checks, so it should not need any special workarounds to perform privileged operations, such as reading /etc/shadow when using the pam_unix PAM module. See MDEV-7032 for more information.\n\nCreating Users\n\nTo create a user in MariaDB which uses the pam authentication plugin, execute CREATE USER while specifying the name of the plugin in the IDENTIFIED VIA clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA pam;\n`\n\nIf SQL_MODE does not have NO_AUTO_CREATE_USER set, then you can also create the user this way with GRANT:\n\n`sql\nGRANT SELECT ON db. TO username@hostname IDENTIFIED VIA pam;\n`\n\nYou can also specify a PAM service name for MariaDB to use by providing it with the USING clause:\n\n`sql\nCREATE USER username@hostname IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nThis line creates a user that needs to be authenticated via the pam authentication plugin using the PAM service name mariadb. As mentioned in a previous section, this service''s configuration file will typically be present in /etc/pam.d/mariadb.\n\nIf no service name is specified, then the plugin will use mysql as the default PAM service name.\n\nClient Authentication Plugins\n\nFor clients that use the libmysqlclient or MariaDB Connector/C libraries, MariaDB provides two client authentication plugins that are compatible with the pam authentication plugin:\n\n dialog\n mysql_clear_password\n\nWhen connecting with a client or utility to a server as a user account that authenticates with the pam authentication plugin, you may need to tell the client where to find the relevant client authentication plugin by specifying the --plugin-dir option:\n\n`bash\nmariadb --plugin-dir=/usr/local/mysql/lib64/mysql/plugin --user=alice\n`\n\nBoth the dialog and the mysql_clear_password client authentication plugins transmit the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is very important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\ndialog\n\nUsually the pam authentication plugin uses the dialog client authentication plugin to communicate with the user. This client authentication plugin allows MariaDB to support arbitrarily complex PAM configurations with regular or one-time passwords, challenge-response, multiple questions, or just about anything else. When using a MariaDB client library, there is no need to install or enable anything — the dialog client authentication plugin is loaded by the client library completely automatically and transparently for the application.\n\nThe dialog client authentication plugin was developed by MariaDB, so MySQL''s clients and client libraries as well as third party applications that bundle MySQL''s client libraries do not support the dialog client authentication plugin out of the box. If the server tells an unsupported client to use the dialog client authentication plugin, then the client is likely to throw an error like the following:\n\n`\nERROR 2059 (HY000): Authentication plugin ''dialog'' cannot be loaded: /usr/lib/mysql/plugin/dialog.so: cannot open shared object file: No such file or directory\n`\n\nFor some libraries or applications, this problem can be fixed by copying dialog.so or dialog.dll from a MariaDB client installation that is compatible with the system into the system''s MySQL client authentication plugin directory. However, not all clients are compatible with the dialog client authentication plugin, so this may not work for every client.\n\nIf your client does not support the dialog client authentication plugin, then you may need to use the mysql_clear_password client authentication plugin instead.\n\nThe dialog client authentication plugin transmits the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is incredibly important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\nmysql_clear_password\n\nUsers can instruct the pam authentication plugin to use the mysql_clear_password client authentication plugin instead of the dialog client authentication plugin by configuring the pam_use_cleartext_plugin system variable on the server. It can be set in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\npam_use_cleartext_plugin\n`\n\nIt is important to note that the mysql_clear_password plugin has very limited functionality.\n\n The mysql_clear_password client authentication plugin only supports PAM services that require password-based authentication.\n The mysql_clear_password client authentication plugin also only supports PAM services that ask the user a single question.\n If the PAM service requires challenge-responses, multiple questions, or other similar complicated authentication schemes, then the PAM service is not compatible with mysql_clear_password client authentication plugin. In that case, the dialog client authentication plugin will have to be used instead.\n\nThe mysql_clear_password client authentication plugin transmits the password to the server in clear text. Therefore, when you use the pam authentication plugin, it is incredibly important to encrypt client connections using TLS to prevent the clear-text passwords from being seen by unauthorized users.\n\nCompatiblity with MySQL Clients and Client Libraries\n\nThe mysql_clear_password client authentication plugin is similar to MySQL''s mysql_clear_password client authentication plugin.\n\nThe mysql_clear_password client authentication plugin is compatible with MySQL clients and most MySQL client libraries, while the dialog client authentication plugin is not always compatible with them. Therefore, the mysql_clear_password client authentication plugin is most useful if you need some kind of MySQL compatibility in your environment, but you still want to use the pam authentication plugin.\n\nEven though the mysql_clear_password client authentication plugin is compatible with MySQL clients and most MySQL client libraries, the mysql_clear_password client authentication plugin may be disabled by default by these clients and client libraries. For example, MySQL''s version of the mysql command-line client has the --enable-cleartext-plugin option that must be set in order to use the mysql_clear_password client authentication plugin:\n\n`bash\nmysql --enable-cleartext-plugin --user=alice -p\n`\n\nOther clients may require other methods to enable the authentication plugin. For example, MySQL Workbench has a checkbox titled Enable Cleartext Authentication Plugin under the Advanced tab on the connection configuration screen.\n\nFor applications that use MySQL''s libmysqlclient, the authentication plugin can be enabled by setting the MYSQL_ENABLE_CLEARTEXT_PLUGIN option with the mysql_options() function:\n\n`ini\nmysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, 1);\n`\n\nFor MySQL compatibility, MariaDB Connector/C also allows applications to set the MYSQL_ENABLE_CLEARTEXT_PLUGIN option with the mysql_optionsv function. However, this option does not actually do anything in MariaDB Connector/C, because the mysql_clear_password client authentication plugin is always enabled for MariaDB clients and client libraries.\n\nSupport in Client Libraries\n\nUsing the Plugin with MariaDB Connector/C\n\nMariaDB Connector/C supports pam authentication using the client authentication plugins, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/ODBC\n\nMariaDB Connector/ODBC supports pam authentication using the client authentication plugins, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/J\n\nMariaDB Connector/J supports pam v1 authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nMariaDB Connector/J supports pam v2 authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MariaDB Connector/Node.js\n\nMariaDB Connector/Node.js supports pam authentication, regardless of the value of the pam_use_cleartext_plugin system variable.\n\nUsing the Plugin with MySqlConnector for .NET\n\nMySqlConnector for ADO.NET supports pam authentication, but on\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-plugin-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (109, 5, 'Authentication with JWT, OIDC, and OAuth 2.0 via PAM', 'Description\n-----------\n\nThis draft, intended for technical review under DOCS-5715, requires validation for technical accuracy. It includes generated text and code blocks and needs evaluation by a subject matter expert (SME) in this format. Please refrain from relying on any information on the page.\n\nMariaDB Server supports modern authentication standards—including JSON Web Tokens (JWT), OpenID Connect (OIDC), and OAuth 2.0—through its pluggable authentication architecture.\n\nBy leveraging the operating system''s PAM (Pluggable Authentication Modules) subsystem, MariaDB can integrate with external Identity Providers (IdPs) like AWS Cognito, Google Cloud Identity, and Azure AD without requiring proprietary database plugins. The database delegates the validation of tokens to the underlying OS security layer.\n\nPrerequisites\n\nBefore proceeding, ensure the following components are available:\n\n MariaDB Server (Active and running).\n PAM Module: You must install a third-party PAM module corresponding to your desired authentication method (e.g., pam_oidc.so, pam_oauth2.so, or pam_jwt.so).\n   _Note: These are system-level libraries installed into /lib/security or /lib64/security. Ensure the module you choose is actively maintained and compatible with your OS._\n Identity Provider (IdP): You must have your Issuer URL, Client ID, and Audience values ready from your provider (e.g., Google, Okta, Azure).\n\nConfiguration and Connection Workflow\n\n_How to bridge the operating system''s authentication layer with MariaDB user management._\n\nHow Authentication Works\n\nBefore configuring the system, it is helpful to understand the handshake between the Client, the Database, and the Operating System.\n\n``mermaid\nsequenceDiagram\n    participant Client as Client (User/App)\n    participant DB as MariaDB Server\n    participant Plugin as auth_pam Plugin\n    participant OS as OS PAM Subsystem\n    participant Module as PAM Module (pam_oidc.so)\n\n    Note over Client, DB: Step 3: Connect via Client\n    Client->>DB: Connect(Username, Password=Token)\n    \n    Note over DB, Plugin: Step 2: Configure MariaDB Server\n    DB->>DB: Check User Definition\n    DB->>Plugin: Delegate Auth (User is IDENTIFIED VIA PAM)\n    \n    Note over Plugin, OS: Step 1: Configure PAM Service\n    Plugin->>OS: Authenticate using Service "mariadb"\n    OS->>OS: Read /etc/pam.d/mariadb\n    \n    Note right of OS: This file tells OS to load pam_oidc.so\n    OS->>Module: Invoke pam_oidc.so with Token\n    \n    Module->>Module: Validate Token (Issuer/Audience)\n    Module-->>OS: Return Success/Failure\n    OS-->>Plugin: Return Success/Failure\n    Plugin-->>DB: Return Auth Result\n    DB-->>Client: Connection Accepted/Rejected\n`\n\nConfigure the PAM Service\n\nYou must define a PAM service that loads your chosen module. This file tells the operating system how to validate the credentials passed by MariaDB.\n\nFile: /etc/pam.d/mariadb\n\n_The specific flags below (like issuer or aud) are standard OIDC parameters. Consult your specific PAM module''s documentation for exact flag syntax._\n\n`bash\n/etc/pam.d/mariadb\nGeneric OIDC Configuration Example\n\n1. ''auth'' checks the validity of the token\nauth required pam_oidc.so issuer=https://accounts.google.com aud=YOUR_CLIENT_ID\n\n2. ''account'' checks if the user is allowed to login (often required by PAM)\naccount required pam_oidc.so\n`\n\nEnsure strict validation of the aud (Audience) parameter to confirm that tokens are issued exclusively for your database application, preventing the use of tokens intended for different applications.\n\nConfigure MariaDB Server\n\nOnce the OS is configured, you must enable the PAM plugin in MariaDB and create a user that utilizes it.\n\n1. Log in to MariaDB as root.\n2.  Install the PAM Plugin:\n\n    `sql\n    INSTALL SONAME ''auth_pam'';\n    `\n3.  Create the User: The USING clause specifies the service name (filename) in /etc/pam.d/.\n\n    `sql\n    -- Create a user that maps to the ''sub'' (Subject) claim in the token\n    CREATE USER ''jdoe''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\n    `\n\nConnect via Client\n\nWhen connecting, the "Password" field is used to transmit the JWT or OIDC Token.\n\n`bash\n1. Obtain your token (e.g., via gcloud or your IdP''s CLI)\nexport DB_TOKEN="eyJhbGciOiJSUzI1NiIsImtpZ..."\n\n2. Connect to MariaDB, passing the token as the password\nmariadb --user="jdoe" --password="$DB_TOKEN"\n`\n\nTroubleshooting\n\n   Authentication Failure: Check the system authentication logs.\n\n    `bash\n    sudo tail -f /var/log/auth.log\n    `\n\n    _Look for errors regarding "invalid audience," "expired token," or "issuer mismatch."_\n SELinux/AppArmor: If the database cannot access the PAM configuration, ensure your security context allows mysqld to read from /etc/pam.d/.\n* Username Mapping: By default, the MariaDB username must match the identity in the token (often the sub or emailclaim). Some PAM modules allow you to map these (e.g., mapping user@example.com to user); check your module''s user_template` or mapping documentation.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-with-jwt-oidc-and-oauth-2.0-via-pam', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/authentication-with-jwt-oidc-and-oauth-2.0-via-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (110, 5, 'Configuring PAM Authentication and User Mapping with LDAP Authen', 'Description\n-----------\n\nIn this article, we will walk through the configuration of PAM authentication using the pam authentication plugin and user and group mapping with the pam_user_map PAM module. The primary authentication will be handled by the pam_ldap PAM module, which performs LDAP authentication. We will also set up an OpenLDAP server.\n\nHypothetical Requirements\n\nIn this walkthrough, we are going to assume the following hypothetical requirements:\n\n The LDAP user foo should be mapped to the MariaDB user bar. (foo: bar)\n Any LDAP user in the LDAP group dba should be mapped to the MariaDB user dba. (@dba: dba)\n\nSetting up the OpenLDAP Server\n\nBefore we can use LDAP authentication, we first need to set up our OpenLDAP Server. This is usually done on a server that is completely separate from the database server.\n\nInstalling the OpenLDAP Server and Client Components\n\nOn the server acting as the OpenLDAP Server, first, we need to install the OpenLDAP components.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, that would go like this:\n\n``bash\nsudo yum install openldap openldap-servers openldap-clients nss-pam-ldapd\n`\n\nConfiguring the OpenLDAP Server\n\nNext, let''s to configure the OpenLDAP Server. The easiest way to do that is to copy the template configuration file that is included with the installation. In many installations, that will be at /usr/share/openldap-servers/DB_CONFIG.example:\n\n`bash\nsudo cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG\nsudo chown ldap. /var/lib/ldap/DB_CONFIG\n`\n\nConfiguring the OpenLDAP Port\n\nSometimes it is useful to change the port used by OpenLDAP. For example, some cloud environments block well-known authentication services, so they block the default LDAP port.\n\nOn some systems, the port can be changed by setting SLAPD_URLS in /etc/sysconfig/slapd:\n\n`ini\nSLAPD_URLS="ldapi:/// ldap://0.0.0.0:3306/"\n`\n\nI used 3306 because that is the port that is usually used by mysqld, so I know that it is not blocked.\n\nStarting the OpenLDAP Server\n\nNext, let''s start the OpenLDAP Server and configure it to start on reboot. On systemd systems, that would go like this:\n\n`bash\nsudo systemctl start slapd\nsudo systemctl enable slapd\n`\n\nInstalling the Standard LDAP objectClasses\n\nIn order to use LDAP for authentication, we also need to install some standard objectClasses, such as posixAccount and posixGroup. In LDAP, things like objectClasses are defined in LDIF files. In many installations, these specific objectClasses are defined in /etc/openldap/schema/nis.ldif. nis.ldif also depends on core.ldif and cosine.ldif. However, core.ldif is usually installed by default.\n\nWe can install them with ldapmodify:\n\n`bash\nsudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif\nsudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif\n`\n\nCreating the LDAP Directory Manager User\n\nNext, let’s create a directory manager user. We can do this by using OpenLDAP''s olc configuration system to change the olcRootDN directive to the DN of the directory manager user, which means that the user will be a privileged LDAP user that is not subject to access controls. We will also set the root password for the user by changing the olcRootPW directive.\n\nWe will also set the DN suffix for our backend LDAP database by changing the olcSuffix directive.\n\nLet’s use the slappasswd utility to generate a password hash from a clear-text password. Simply execute:\n\n`bash\nslappasswd\n`\n\nThis utility provides a password hash that looks like this: {SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl\n\nOpenLDAP''s olc configuration system also uses LDIF files. Now that we have the password hash, let’s create an LDIF file to create the directory manager user:\n\n`bash\ntee ~/setupDirectoryManager.ldif <<EOF\ndn: olcDatabase={1}monitor,cn=config\nchangetype: modify\nreplace: olcAccess\nolcAccess: {0}to  \n    by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read \n    by dn.base="cn=Manager,dc=support,dc=mariadb,dc=com" read \n    by  none\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nreplace: olcSuffix\nolcSuffix: dc=support,dc=mariadb,dc=com\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nreplace: olcRootDN\nolcRootDN: cn=Manager,dc=support,dc=mariadb,dc=com\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nadd: olcRootPW\nolcRootPW: {SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl\n\ndn: olcDatabase={2}hdb,cn=config\nchangetype: modify\nadd: olcAccess\nolcAccess: {0}to attrs=userPassword,shadowLastChange \n    by   dn="cn=Manager,dc=support,dc=mariadb,dc=com" write \n    by anonymous auth \n    by self write \n    by  none\nolcAccess: {1}to dn.base="" \n    by  read\nolcAccess: {2}to  \n    by dn="cn=Manager,dc=support,dc=mariadb,dc=com" write \n    by  read\nEOF\n`\n\nNote that this is using the dc=support,dc=mariadb,dc=com domain for the directory. You can change it to whatever is relevant to you.\n\nNow let’s run the ldif file with ldapmodify:\n\n`bash\nsudo ldapmodify -Y EXTERNAL -H ldapi:/// -f ~/setupDirectoryManager.ldif\n`\n\nWe will use the new directory manager user to make changes to the LDAP directory after this step.\n\nCreating the Structure of the Directory\n\nNext, let''s create the structure of the directory by creating parts of our tree.\n\n`bash\ntee ~/setupDirectoryStructure.ldif <<EOF\ndn: dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: dcObject\nobjectclass: organization\no: MariaDB Support Team\ndc: support\n\ndn: cn=Manager,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalRole\ncn: Manager\ndescription: Directory Manager\n\ndn: ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: People\n\ndn: ou=Groups,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: Groups\n\ndn: ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: organizationalUnit\nou: System Users\nEOF\n`\n\nNow, let’s use our new directory manager user and run the LDIF file with ldapmodify:\n\n`\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/setupDirectoryStructure.ldif\n`\n\nCreating the LDAP Users and Groups\n\nLet''s go ahead and create the LDAP users and groups that we are using for this scenario.\n\nFirst, let''s create the foo user:\n\n`bash\ntee ~/createFooUser.ldif <<EOF\ndn: uid=foo,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: foo\nuid: foo\nuidNumber: 16859\ngidNumber: 100\nhomeDirectory: /home/foo\nloginShell: /bin/bash\ngecos: foo\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createFooUser.ldif\n`\n\nNext, let''s create a couple of users to go into the dba group:\n\n`bash\ntee ~/createDbaUsers.ldif <<EOF\ndn: uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: gmontee\nuid: gmontee\nuidNumber: 16860\ngidNumber: 100\nhomeDirectory: /home/gmontee\nloginShell: /bin/bash\ngecos: gmontee\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\n\ndn: uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: bstillman\nuid: bstillman\nuidNumber: 16861\ngidNumber: 100\nhomeDirectory: /home/bstillman\nloginShell: /bin/bash\ngecos: bstillman\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaUsers.ldif\n`\n\nNote that each of these users needs a password, so we can set it for each user with ldappasswd:\n\n`\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=foo,ou=People,dc=support,dc=mariadb,dc=com\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com\nldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com\n`\n\nNext, let''s create our dba group:\n\n`bash\ntee ~/createDbaGroup.ldif <<EOF\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: posixGroup\ngidNumber: 678\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaGroup.ldif\n`\n\nNext, let''s add our two users to it:\n\n`bash\ntee ~/addUsersToDbaGroup.ldif <<EOF\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nchangetype: modify\nadd: memberuid\nmemberuid: gmontee\n\ndn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com\nchangetype: modify\nadd: memberuid\nmemberuid: bstillman\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/addUsersToDbaGroup.ldif\n`\n\nWe also need to create LDAP users with the same name as the bar and dba MariaDB users. See here to read more about the reasons to do so. No one will be logging in as these users, so they do not need passwords. Instead of the People organizationalUnit, we create them in the System Users organizationalUnit.\n\n`bash\ntee ~/createSystemUsers.ldif <<EOF\ndn: uid=bar,ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: bar\nuid: bar\nuidNumber: 16862\ngidNumber: 100\nhomeDirectory: /home/bar\nloginShell: /bin/bash\ngecos: bar\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\n\ndn: uid=dba,ou=System Users,dc=support,dc=mariadb,dc=com\nobjectClass: top\nobjectClass: account\nobjectClass: posixAccount\nobjectClass: shadowAccount\ncn: dba\nuid: dba\nuidNumber: 16863\ngidNumber: 100\nhomeDirectory: /home/dba\nloginShell: /bin/bash\ngecos: dba\nuserPassword: {crypt}x\nshadowLastChange: -1\nshadowMax: -1\nshadowWarning: 0\nEOF\nldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createSystemUsers.ldif\n`\n\nSetting up the MariaDB Server\n\nAt this point, we can move on to setting up the MariaDB Server.\n\nInstalling LDAP and PAM Libraries\n\nFirst, we need to make sure that the LDAP and PAM libraries are installed.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install the following packages:\n\n`bash\nsudo yum install openldap-clients nss-pam-ldapd pam pam-devel\n`\n\nConfiguring LDAP\n\nNext, let''s configure LDAP on the system. We can use authconfig for this:\n\n`bash\nsudo authconfig --enableldap \\\n   --enableldapauth \\\n   --ldapserver="ldap://172.30.0.238:3306" \\\n   --ldapbasedn="dc=support,dc=mariadb,dc=com" \\\n   --enablemkhomedir \\\n   --update\n`\n\nBe sure to replace -–ldapserver and -–ldapbasedn with values that are relevant for your environment.\n\nInstalling the pam_user_map PAM Module\n\nThe pam_user_map PAM module is included in the base install. No installation is needed.\n\nNext, let''s install the pam_user_map PAM module.\n\nBefore the module can be compiled from source, we may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install gcc and pam-devel:\n\n`bash\nsudo yum install gcc pam-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, we need to install gcc and libpam0g-dev:\n\n`bash\nsudo apt-get install gcc libpam0g-dev\n`\n\nAnd then we can build and install the library with the following:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c \ngcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so \nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nConfiguring the pam_user_map PAM Module\n\nNext, let''s configure the pam_user_map PAM module based on our hypothetical requirements.\n\nThe configuration file for the pam_user_map PAM module is /etc/security/user_map.conf. Based on our requirements, ours would look like:\n\n`\nfoo: bar\n@dba:dba\n`\n\nInstalling the PAM Authentication Plugin\n\nNext, let''s install the pam authentication plugin.\n\nLog into the MariaDB Server and execute the following:\n\n`sql\nINSTALL SONAME ''auth_pam'';\n`\n\nConfiguring the PAM Service\n\nFor modern Linux distributions (like RHEL 8 and newer) that use SSSD (System Security Services Daemon) to connect to an LDAP provider, the pam_sss.so module is the modern equivalent of pam_ldap.so. In such a configuration, pam_sss.so replaces pam_ldap.so. For more information, please see the Red Hat Enterprise Linux documentation.\n\nNext, let''s configure the PAM service. We will call our service mariadb, so our PAM service configuration file will be located at /etc/pam.d/mariadb on most systems.\n\nConfiguring PAM to Allow Only LDAP Authentication\n\nSince we are only doing LDAP authentication with the pam_ldap PAM module and group mapping with the pam_user_map PAM module, our configuration file would look like this:\n\n`\nauth required pam_ldap.so\nauth required pam_user_map.so\naccount required pam_ldap.so\n`\n\nConfiguring PAM to Allow LDAP and Local Unix Authentication\n\nIf we want to allow authentication from LDAP users and from local Unix users through pam_unix, while giving priority to the local users, then we could do this instead:\n\n`\nauth [success=1 new_authtok_reqd=1 default=ignore] pam_unix.so audit\nauth required pam_ldap.so try_first_pass\nauth required pam_user_map.so\naccount sufficient pam_unix.so audit\naccount required pam_ldap.so\n`\n\nConfiguring the pam_unix PAM Module\n\nIf you also want to allow authentication from local Unix users, the pam_unix PAM module adds some additional configuration steps on a lot of systems. We basically have to give the user that runs mysqld access to /etc/shadow.\n\nIf the mysql user is running mysqld, then we can do that by executing the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nThe server needs to be restarted for this change to take affect.\n\nCreating MariaDB Users\n\nNext, let''s create the MariaDB users. Remember that our PAM service is called mariadb.\n\nFirst, let''s create the MariaDB user for the user mapping: foo: bar\n\nThat means that we need to create a bar user:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n`\n\nAnd then let''s create the MariaDB user for the group mapping: @dba: dba\n\nThat means that we need to create a dba user:\n\n`sql\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n`\n\nAnd then to allow for the user and group mapping, we need to create an anonymous user that authenticates with the pam authentication plugin that is also able to PROXY as the bar and dba users. Before we can create the proxy user, we might need to clean up some defaults:\n\n`sql\nDELETE FROM mysql.db WHERE User='''' AND Host=''%'';\nFLUSH PRIVILEGES;\n`\n\nAnd then let''s create the anonymous proxy user:\n\n`sql\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nTesting our Configuration\n\nNext, let''s test our configuration by verifying that mapping\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-ldap-authentication');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (111, 5, 'Configuring PAM Authentication and User Mapping with Unix Authen', 'Description\n-----------\n\nWe walk through the configuration of PAM authentication using the pam authentication plugin and user and group mapping with the pam_user_map PAM module. The primary authentication will be handled by the pam_unix PAM module, which performs standard Unix password authentication.\n\nHypothetical Requirements\n\nIn this walkthrough, we are going to assume the following hypothetical requirements:\n\n The Unix user foo should be mapped to the MariaDB user bar. (foo: bar)\n Any Unix user in the Unix group dba should be mapped to the MariaDB user dba. (@dba: dba)\n\nCreating Our Unix Users and Groups\n\nLet''s go ahead and create the Unix users and groups that we are using for this hypothetical scenario.\n\nFirst, let''s create the foo user and a couple users to go into the dba group. Note that each of these users needs a password.\n\n``bash\nsudo useradd foo\nsudo passwd foo\nsudo useradd alice\nsudo passwd alice\nsudo useradd bob\nsudo passwd bob\n`\n\nNext, let''s create the dba group and add our two users to it:\n\n`bash\nsudo groupadd dba\nsudo usermod -a -G dba alice \nsudo usermod -a -G dba bob\n`\n\nWe also need to create Unix users with the same name as the bar and dba MariaDB users. See here to read more about why. No one will be logging in as these users, so they do not need passwords.\n\n`bash\nsudo useradd bar\nsudo useradd dba -g dba\n`\n\nInstalling the pam_user_map PAM Module\n\nNext, let''s install the pam_user_map PAM module.\n\nBefore the module can be compiled from source, we may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, we need to install gcc and pam-devel:\n\n`bash\nsudo yum install gcc pam-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, we need to install gcc and libpam0g-dev:\n\n`\nsudo apt-get install gcc libpam0g-dev\n`\n\nAnd then we can build and install the library with the following:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c \ngcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so \nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nConfiguring the pam_user_map PAM Module\n\nNext, let''s configure the pam_user_map PAM module based on our hypothetical requirements.\n\nThe configuration file for the pam_user_map PAM module is /etc/security/user_map.conf. Based on our hypothetical requirements, ours would look like:\n\n`\nfoo: bar\n@dba:dba\n`\n\nInstalling the PAM Authentication Plugin\n\nNext, let''s install the pam authentication plugin.\n\nLog into the MariaDB Server and execute the following:\n\n`\nINSTALL SONAME ''auth_pam'';\n`\n\nConfiguring the PAM Service\n\nNext, let''s configure the PAM service. We will call our service mariadb, so our PAM service configuration file will be located at /etc/pam.d/mariadb on most systems.\n\nSince we are only doing Unix authentication with the pam_unix PAM module and group mapping with the pam_user_map PAM module, our configuration file would look like this:\n\n`ini\nauth required pam_unix.so audit\nauth required pam_user_map.so\naccount required pam_unix.so audit\n`\n\nConfiguring the pam_unix PAM Module\n\nThe pam_unix PAM module adds some additional configuration steps on a lot of systems. We basically have to give the user that runs mysqld access to /etc/shadow.\n\nIf the mysql user is running mysqld, then we can do that by executing the following:\n\n`bash\nsudo groupadd shadow\nsudo usermod -a -G shadow mysql\nsudo chown root:shadow /etc/shadow\nsudo chmod g+r /etc/shadow\n`\n\nThe server needs to be restarted for this change to take affect.\n\nCreating MariaDB Users\n\nNext, let''s create the MariaDB users. Remember that our PAM service is called mariadb.\n\nFirst, let''s create the MariaDB user for the user mapping: foo: bar . This means we need to create a bar user:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n`\n\nNext, let''s create the MariaDB user for the group mapping: @dba: dba . This means that we need to create a dba user:\n\n`sql\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n`\n\nNext, to allow for the user and group mapping, we need to create an anonymous user that authenticates with the pam authentication plugin that is also able to PROXY as the bar and dba users. Before we can create the proxy user, we might need to clean up some defaults:\n\n`sql\nDELETE FROM mysql.db WHERE User='''' AND Host=''%'';\nFLUSH PRIVILEGES;\n`\n\nFinally, let''s create the anonymous proxy user:\n\n`sql\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nTesting our Configuration\n\nNext, let''s test out our configuration by verifying that mapping is occurring. We can verify this by logging in as each of our users and comparing the return value of USER(), which is the original user name and the return value of CURRENT_USER(), which is the authenticated user name.\n\nFirst, let''s test our foo user:\n\n`bash\n$ mysql -u foo -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 22\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| foo@ip-172-30-0-198.us-west-2.compute.internal | bar@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our foo Unix user was properly mapped to the bar MariaDB user by looking at the return value of CURRENT_USER().\n\nNext, let''s test our alice user in the dba group:\n\n`bash\n$ mysql -u alice -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 19\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+--------------------------------------------------+----------------+\n| USER()                                           | CURRENT_USER() |\n+--------------------------------------------------+----------------+\n| alice@ip-172-30-0-198.us-west-2.compute.internal | dba@%          |\n+--------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nFinally, let''s test our bob user in the dba group:\n\n`bash\n$ mysql -u bob -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 20\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| bob@ip-172-30-0-198.us-west-2.compute.internal | dba@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our alice and bob Unix users in the dba Unix group were properly mapped to the dba MariaDB user by looking at the return values of CURRENT_USER()`.\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-unix-authentication', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/configuring-pam-authentication-and-user-mapping-with-unix-authentication');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (112, 5, 'User and Group Mapping with PAM', 'Description\n-----------\n\nEven when using the pam authentication plugin, the authenticating PAM user account still needs to exist in MariaDB, and the account needs to have privileges in the database. Creating these MariaDB accounts and making sure the privileges are correct can be a lot of work. To decrease the amount of work involved, some users would like to be able to map a PAM user to a different MariaDB user. For example, let’s say that alice and bob are both DBAs. It would be nice if each of them could log into MariaDB with their own PAM username and password, while MariaDB sees both of them as the same dba user. That way, there is only one MariaDB account to keep track of.\n\nAlthough most PAM modules usually do not do things like this, PAM supports the ability to change the user name in the process of authentication.The MariaDB pam authentication plugin fully supports this feature of PAM.\n\nThe pam_user_map PAM Module\n\nRather than building user and group mapping into the pam authentication plugin, MariaDB thought that it would cover the most use cases and offer the most flexibility to offload this functionality to an external PAM module. The pam_user_map PAM module was implemented by MariaDB to facilitate this. This PAM module can be configured in the PAM service used by the pam authentication plugin, just like other PAM modules.\n\nLack of Support for MySQL/Percona Group Mapping Syntax\n\nUnlike MariaDB, MySQL and Percona implemented group mapping in their PAM authentication plugins. If you''ve read through MySQL''s PAM authentication documentation on group mapping or Percona''s PAM authentication documentation on group mapping, you''ve probably seen syntax where the group mappings are provided in the CREATE USER statement like this:\n\n``sql\nCREATE USER ''''@''''\n  IDENTIFIED WITH authentication_pam\n  AS ''mysql, root=developer, users=data_entry'';\n`\n\nSince MariaDB''s user and group mapping is performed by an external PAM module, MariaDB''s pam authentication plugin does not support this syntax. Instead, the user and group mappings for the pam_user_map PAM module are configured in an external configuration file. This is discussed in a later section.\n\nInstalling the pam_user_map PAM Module\n\nThe pam_user_map PAM module gets installed as part of all our MariaDB server packages.\n\nSome Linux distributions have not picked up this change in their own packages yet. When using such an installation, it may be necessary to compile the PAM module from source as described in the next section, or to manually extract it from one of our server packages and copy it to the target system.\n\nInstalling the pam_user_map PAM Module from Source\n\nInstalling Compilation Dependencies\n\nBefore the module can be compiled from source, you may need to install some dependencies.\n\nOn RHEL, CentOS, and other similar Linux distributions that use RPM packages, you need to install gcc, pam-devel and MariaDB-devel:\n\n`bash\nsudo yum install gcc pam-devel MariaDB-devel\n`\n\nOn Debian, Ubuntu, and other similar Linux distributions that use DEB packages, you need to install gcc, libpam0g-dev:\n\n`bash\nsudo apt-get install gcc libpam0g-dev libmariadb-dev\n`\n\nCompiling and Installing the pam_user_map PAM Module\n\nThe pam_user_map PAM module can be built by downloading plugin/auth_pam/mapper/pam_user_map.c file from the MariaDB source tree and compiling it after minor adjustments. Once it is built, it can be installed to the system''s PAM module directory, which is typically /lib64/security/:\n\n`bash\nwget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c\nsed -ie ''s/config_auth_pam/plugin_auth_common/'' pam_user_map.c\ngcc -I/usr/include/mysql/ pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so\nsudo install --mode=0755 pam_user_map.so /lib64/security/\n`\n\nYou also need to adjust the major version number in the URL on the first line to match your installed MariaDB version, and the #-I include path argument on the gcc line, as depending on operating system and MariaDB server version, the plugin_auth_common.h file may be installed in a directory other than /usr/include/mysql/ .\n\nConfiguring the pam_user_map PAM Module\n\nThe pam_user_map PAM module uses the configuration file at the path /etc/security/user_map.conf to determine its user and group mappings. The file''s format is described below.\n\nTo map a specific PAM user to a specific MariaDB user:\n\n`\norig_pam_user_name: mapped_mariadb_user_name\n`\n\nOr to map any PAM user in a specific PAM group to a specific MariaDB user, the group name is prefixed with @:\n\n`\n@orig_pam_group_name: mapped_mariadb_user_name\n`\n\nFor example, here is an example /etc/security/user_map.conf:\n\n`\n=========================================================\n#comments and empty lines are ignored\njohn: jack\nbob:  admin\ntop:  accounting\n@group_ro: readonly\n`\n\nConfiguring PAM\n\nWith user and group mapping, configuring PAM is done similar to how it is normally done with the pam authentication plugin. However, when configuring the PAM service, you will have to add an auth line for the pam_user_map PAM module to the service''s PAM configuration file:\n\n`\nauth required pam_unix.so audit\nauth required pam_user_map.so\naccount required pam_unix.so audit\n`\n\nCreating Users\n\nWith user and group mapping, creating users is done similar to how it is normally done with the pam authentication plugin. However, one major difference is that you will need to GRANT the PROXY privilege on the mapped user to the original user.\n\nConsider having the following configured in /etc/security/user_map.conf:\n\n`\nfoo: bar\n@dba:dba\n`\n\nThen you could execute the following to grant the relevant privileges:\n\n`sql\nCREATE USER ''bar''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''bar''@''%'' ;\n\nCREATE USER ''dba''@''%'' IDENTIFIED BY ''strongpassword'';\nGRANT ALL PRIVILEGES ON . TO ''dba''@''%'' ;\n\nCREATE USER ''''@''%'' IDENTIFIED VIA pam USING ''mariadb'';\nGRANT PROXY ON ''bar''@''%'' TO ''''@''%'';\nGRANT PROXY ON ''dba''@''%'' TO ''''@''%'';\n`\n\nNote that the ''''@''%'' account is a special catch-all anonymous account. Any login by a user that has no more specific account match in the system will be matched by this anonymous account.\n\nAlso note that you might not be able to create the ''''@''%'' anonymous account by default on some systems without doing some extra steps first. See Fixing a Legacy Default Anonymous Account for more information.\n\nVerifying that Mapping is Occurring\n\nIn case any user mapping is performed, the original user name is returned by the SQL function USER(), while the authenticated user name is returned by the SQL function CURRENT_USER(). The latter actually defines what privileges are available to a connected user.\n\nConsider having the following configured:\n\n`\nfoo: bar\n`\n\nThen the following output would verify that it is working properly:\n\n`bash\n$ mysql -u foo -h 172.30.0.198\n[mariadb] Password:\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 22\nServer version: 10.3.10-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType ''help;'' or ''\\h'' for help. Type ''\\c'' to clear the current input statement.\n\nMariaDB [(none)]> SELECT USER(), CURRENT_USER();\n+------------------------------------------------+----------------+\n| USER()                                         | CURRENT_USER() |\n+------------------------------------------------+----------------+\n| foo@ip-172-30-0-198.us-west-2.compute.internal | bar@%          |\n+------------------------------------------------+----------------+\n1 row in set (0.000 sec)\n`\n\nWe can verify that our foo PAM user was properly mapped to the bar MariaDB user by looking at the return value of CURRENT_USER().\n\nLogging\n\nBy default, the pam_user_map PAM module does not perform any logging. However, if you want to enable debug logging, then you can add the debug module argument to the service''s PAM configuration file:\n\n`\nauth required pam_unix.so audit\nauth required pam_user_map.so debug\naccount required pam_unix.so audit\n`\n\nWhen debug logging is enabled, the pam_user_map PAM module will write log entries to the same syslog location as other PAM modules, which is typically /var/log/secure on many systems.\n\nFor example, this debug log output can look like the following:\n\n`\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''alice''.\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 2 groups [alice,dba].\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': YES\nJan  9 05:42:13 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''dba''\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''bob''.\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 2 groups [bob,dba].\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': YES\nJan  9 05:43:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''dba''\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Opening file ''/etc/security/user_map.conf''.\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Incoming username ''foo''.\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User belongs to 1 group [foo].\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if user is in group ''dba'': NO\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): Check if username ''foo'': YES\nJan  9 06:08:36 ip-172-30-0-198 mysqld: pam_user_map(mariadb:auth): User mapped as ''bar''\n`\n\nKnown Issues\n\nPAM User with Same Name as Mapped MariaDB User Must Exist\n\nWith user and group mapping, any PAM user or any PAM user in a given PAM group can be mapped to a specific MariaDB user account. However, due to the way PAM works, a PAM user with the same name as the mapped MariaDB user account must exist.\n\nConsider the configuration file for the PAM service file containing the following:\n\n`\nauth required pam_sss.so\nauth required pam_user_map.so debug\naccount sufficient pam_unix.so\naccount sufficient pam_sss.so\n`\n\nConsider etc/security/user_map.conf containing the following:\n\n`\n@dba: dba\n`\n\nIn that case, any PAM user in the PAM group dba are mapped to the MariaDB user account dba. But if a PAM user with the name dba doesn''t exist, the pam_user_map PAM module''s debug logging writes errors to the syslog, like the following:\n\n`\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Opening file ''/etc/security/user_map.conf''.\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Incoming username ''alice''.\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): User belongs to 4 groups [dba,mongod,mongodba,mysql].\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): Check if user is in group ''mysql'': YES\nSep 27 17:17:05 dbserver1 mysqld: pam_user_map(mysql:auth): User mapped as ''dba''\nSep 27 17:17:05 dbserver1 mysqld: pam_unix(mysql:account): could not identify user (from getpwnam(dba))\nSep 27 17:17:05 dbserver1 mysqld: pam_sss(mysql:account): Access denied for user dba: 10 (User not known to the underlying authentication module)\nSep 27 17:17:05 dbserver1 mysqld: 2018-09-27 17:17:05 72 [Warning] Access denied for user ''alice''@''localhost'' (using password: NO)\n`\n\nIn the above log snippet, notice that both the pam_unix and the pam_sss PAM modules are complaining that the dba PAM user does not appear to exist, and that these complaints cause the PAM authentication process to fail, which causes the MariaDB authentication process to fail as well.\n\nThis can be fixed by creating a PAM user with the same name as the mapped MariaDB user account, which is dba in this case.\n\nYou may also be able to work around this problem by essentially disabling PAM''s account verification for the service with the pam_permit PAM module. For example, in the above case, that would be:\n\n`\nauth required pam_sss.so\nauth required pam_user_map.so debug\naccount required pam_permit.so\n``\n\nSee MDEV-17315 for more information.\n\nTutorials\n\nYou may find the following PAM and user mapping-related tutorials helpful:\n\n Configuring PAM Authentication and User Mapping with Unix Authentication\n Configuring PAM Authentication and User Mapping with LDAP Authentication\n\nURL: https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/user-and-group-mapping-with-pam', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/authentication-with-pluggable-authentication-modules-pam/user-and-group-mapping-with-pam');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (113, 5, 'Pluggable Authentication Overview', 'Description\n-----------\n\nWhen a user attempts to log in, the authentication plugin controls how MariaDB Server determines whether the connection is from a legitimate user.\n\nWhen creating or altering a user account with the GRANT, CREATE USER or ALTER USER statements, you can specify the authentication plugin you want the user account to use, by providing the IDENTIFIED VIA clause. By default, when you create a user account without specifying an authentication plugin, MariaDB uses the mysql_native_password plugin.\n\nYou can specify multiple authentication plugins for each user account.\n\nThe root@localhost user created by mariadb-install-db has the ability to use two authentication plugins:\n\n1. It is configured to try to use the unix_socket authentication plugin. This allows the root@localhost user to log in without a password via the local Unix socket file defined by the socket system variable, as long as the login is attempted from a process owned by the operating system root user account.\n2. If authentication fails with the unix_socket authentication plugin, it is configured to try to use the mysql_native_password authentication plugin. However, an invalid password is initially set, so in order to authenticate this way, a password must be set with SET PASSWORD.\n\nSupported Authentication Plugins\n\nThe authentication process is a conversation between the server and a client. MariaDB implements both server-side and client-side authentication plugins.\n\nSupported Server Authentication Plugins\n\nMariaDB provides seven server-side authentication plugins:\n\n mysql_native_password\n mysql_old_password\n ed25519\n gssapi\n pam (Unix only)\n unix_socket (Unix only)\n named_pipe (Windows only)\n\nSupported Client Authentication Plugins\n\nMariaDB provides eight client-side authentication plugins:\n\n mysql_native_password\n mysql_old_password\n client_ed25519\n auth_gssapi_client\n dialog\n mysql_clear_password\n sha256_password\n caching_sha256_password\n\nOptions Related to Authentication Plugins\n\nServer Options Related to Authentication Plugins\n\nMariaDB supports the following server options related to authentication plugins:\n\n| Server Option                                                                                                                             | Description                                                                                                                                                                                                                                                                                                              |\n| ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| old_passwords={1 \\| 0}  | If set to 1 (0 is default), MariaDB reverts to using the mysql_old_password authentication plugin by default for newly created users and passwords, instead of the mysql_native_password authentication plugin. |\n| plugin_dir=path            | Path to the plugin directory. For security reasons, either make sure this directory can only be read by the server, or set secure_file_priv.                                                |\n| plugin_maturity=level | The lowest acceptable plugin maturity. MariaDB will not load plugins less mature than the specified level.                                                                                                                                                                                                        |\n| secure_auth               | Connections will be blocked if they use the mysql_old_password authentication plugin.                                                                                                                                                                                   |\n\nClient Options Related to Authentication Plugins\n\nMost clients and utilities support command-line arguments related to client authentication plugins:\n\n| Client Option              | Description                                                                                                                                                                                                   |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| --connect-expired-password | Notify the server that this client is prepared to handle expired password sandbox mode even if --batch was specified.                    |\n| --default-auth=name        | Default authentication client-side plugin to use.                                                                                                                                                             |\n| --plugin-dir=path          | Directory for client-side plugins.                                                                                                                                                                            |\n| --secure-auth              | Refuse to connect to the server if the server uses the mysql_old_password authentication plugin. This mode is off by default, which is different from MySQL. |\n\nDevelopers who are using MariaDB Connector/C can implement similar functionality in their application by setting the following options with the mysql_optionsv function:\n\n MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS\n MYSQL_PLUGIN_DIR\n MYSQL_DEFAULT_AUTH\n MYSQL_SECURE_AUTH\n\nFor example:\n\n``ini\nmysql_optionsv(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);\nmysql_optionsv(mysql, MYSQL_DEFAULT_AUTH, "name");\nmysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");\nmysql_optionsv(mysql, MYSQL_SECURE_AUTH, 1);\n`\n\nInstallation Options Related to Authentication Plugins\n\nmariadb-install-db supports the following installation options related to authentication plugins:\n\n| Installation Option                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| --auth-root-authentication-method={normal \\| socket} | If set to normal (the default), it creates a root@localhost account that authenticates with the mysql_native_password authentication plugin and that has no initial password set, which can be insecure. If set to socket, it creates a root@localhost account that authenticates with the unix_socket authentication plugin. Set to normal by default. |\n| --auth-root-socket-user=USER                         | Used with --auth-root-authentication-method=socket. It specifies the name of the second account to create with SUPER privileges in addition to root, as well as of the system account allowed to access it. Defaults to the value of --user.                                                                                                                          |\n\nExtended SQL Syntax\n\nMariaDB has extended the SQL standard GRANT, CREATE USER, and ALTER USER statements, so that they support specifying different authentication plugins for specific users. An authentication plugin can be specified with these statements by providing the IDENTIFIED VIA clause. Examples:\n\n`sql\nGRANT <privileges> ON <level> TO <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\n`sql\nCREATE USER <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\n`sql\nALTER USER <user> \n   IDENTIFIED VIA <plugin> [ USING <string> ]\n`\n\nThe optional USING clause allows users to provide an authentication string to a plugin. The authentication string''s format and meaning is completely defined by the plugin.\n\nFor example, for the mysql_native_password authentication plugin, the authentication string should be a password hash:\n\n`sql\nCREATE USER mysqltest_up1 \n   IDENTIFIED VIA mysql_native_password USING ''E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'';\n`\n\nSince mysql_native_password is the default authentication plugin, the above is just another way of saying the following:\n\n`\nCREATE USER mysqltest_up1 \n   IDENTIFIED BY PASSWORD ''E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'';\n`\n\nIn contrast, for the pam authentication plugin, the authentication string should refer to a PAM service name:\n\n`sql\nCREATE USER mysqltest_up1 \n   IDENTIFIED VIA pam USING ''mariadb'';\n`\n\nA user account can be associated with multiple authentication plugins.\n\nTo configure the root@localhost user account to try the unix_socket authentication plugin, followed by the mysql_native_password authentication plugin as a backup, execute the following query:\n\n`sql\nCREATE USER root@localhost \n   IDENTIFIED VIA unix_socket \n   OR mysql_native_password USING PASSWORD("verysecret");\n`\n\nSee Authentication for more information.\n\nAuthentication Plugins Installed by Default\n\nServer Authentication Plugins Installed by Default\n\nNot all server-side authentication plugins are installed by default. If a specific server-side authentication plugin is not installed by default, then you can find the installation procedure on the documentation page for the specific authentication plugin.\n\nThe following server-side authentication plugins are installed by default:\n\n The mysql_native_password and mysql_old_password authentication plugins authentication plugins are installed by default in all builds.\n The unix_socket authentication plugin is installed by default in all builds on Unix and Linux.\n The named_pipe authentication plugin is installed by default in all builds on Windows.\n\nThe following server-side authentication plugins are installed by default:\n\n The mysql_native_password and mysql_old_password authentication plugins are installed by default in all builds.\n The unix_socket authentication plugin is installed by default in new installations that use the .deb packages provided by Debian''s default repositories and Ubuntu''s default repositories in Ubuntu. See Differences in MariaDB in Debian (and Ubuntu) for more information.\n The named_pipe authentication plugin is installed by default in all builds on Windows.\n\nClient Authentication Plugins Installed by Default\n\nClient-side authentication plugins do not need to be _installed_ in the same way that server-side authentication plugins do. If the client uses either the libmysqlclient or MariaDB Connector/C library, then the library automatically loads client-side authentication plugins from the library''s plugin directory whenever they are needed.\n\nMost clients and utilities support the --plugin-dir command line argument that can be used to set the path to the library''s plugin directory:\n\n| Client Option     | Description                        |\n| ----------------- | ---------------------------------- |\n| --plugin-dir=path | Directory for client-side plugins. |\n\nDevelopers who are using MariaDB Connector/C can implement similar functionality in their application by setting the MYSQL_PLUGIN_DIR option with the mysql_optionsv function. Example:\n\n`c\nmysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");\n`\n\nIf your client encounters errors similar to the following error, you may need to set the path to the library''s plugin directory:\n\n`\nERROR 2059 (HY000): Authentication plugin ''dialog'' cannot be loaded: /usr/lib/mysql/plugin/dialog.so: cannot open shared object file: No such file or directory\n`\n\nIf the client does not use either the libmysqlclient or MariaDB Connector/C library, then you will have to determine which authentication plugins are supported by the specific client library used by the client.\n\nIf the client uses either the libmysqlclient or MariaDB Connector/C library, but the client is not bundled with either library''s _optional_ client authentication plugins, then you can only use the conventional authentication plugins (like mysql_native_password and mysql_old_password) and the non-conventional authentication plugins that don''t require special client-side authentication plugins (like unix_socket and named_pipe).\n\nDefault Authentication Plugin\n\nDefault Server Authentication Plugin\n\nThe mysql_native_password authentication plugin is currently the default authentication plugin in all versions of MariaDB if the old_passwords system variable is set to 0, which is the default.\n\nOn a system with the old_passwords system variable set to 0, this means that if you create a user account with either the GRANT or CREATE USERstatements, and if you do not specify an authentication plugin with theIDENTIFIED VIAclause, then MariaDB will use the mysql_native_password authentication plugin for the user account.\n\nCreating a user account like this, it uses the mysql_native_password authentication plugin:\n\n`sql\nCREATE USER username@hostname;\n`\n\nThe same is true for this user account:\n\n`sql\nCREATE USER username@hostname IDENTIFIED BY ''notagoodpassword'';\n`\n\nThe mysql_old_password authentication plugin becomes the default authentication plugin in all versions of MariaDB, if the old_passwords system variable is explicitly set to 1.\n\nThe mysql_old_password authentication plugin is not considered secure. It is recommended to avoid using this authentication plugin. To help prevent undesired use of the mysql_old_password authentication plugin, the server supports the secure_auth system variable that configures the server to refuse connections trying to use the mysql_old_password authentication plugin.\n\nMost clients and utilities support secure_auth.\n\n| Server Option                                                                                                                            | Description                                                                                                                                                                                                                                                                                                              |\n| -----------------\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/authentication-plugins/pluggable-authentication-overview');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (114, 5, 'Plugin Maturity', 'Description\n-----------\n\nThe following table lists the various plugins included in MariaDB ordered by their maturity. Note that maturity will differ across MariaDB versions - see below for an easy way to get a complete list of plugins and their maturity in your version of MariaDB:\n\n| Plugin                                                                                                                                                                                                        | Version | Maturity                                                     |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------ |\n| Archive                                                                                                                                                   | 3.0     | Stable                                                       |\n| Aria                                                                                                                                                           | 1.6     | Stable                                                       |\n| Audit Plugin                                                                                                                                  | 1.4     | Stable                                                       |\n| aws_key_management                                                    | 1.0     | Stable                                                       |\n| binlog                                                                                                                                       | 2.0     | Stable                                                       |\n| Blackhole                                                                                                                                               | 1.0     | Stable                                                       |\n| Connect                                                                                                                                                     | 1.7     | Stable                                                       |\n| CLIENT_STATISTICS                                                            | 2.0     | Stable                                                       |\n| cracklib_password_check                                                                                                                 | 1.0     | Stable                                                       |\n| CSV                                                                                                                                                             | 1.0     | Stable                                                       |\n| DECLARE BY / associative array                                                                                                       | 1.0     | Gamma                                                        |\n| DISKS                                                                                                                                                                     | 1.1     | Stable                                                       |\n| ed25519                                                                                                                                         | 1.1     | Stable                                                       |\n| FederatedX                                                                                                                                | 2.1     | Stable                                                       |\n| Feedback                                                                                                                                                               | 1.1     | Stable                                                       |\n| file_key_management                                                  | 2.0     | Gamma                                                        |\n| gssapi                                                                                                                                           | 1.0     | Stable                                                       |\n| INDEX_STATISTICS                                                             | 2.0     | Stable                                                       |\n| INET4                                                                                                                                                                            | 1.0     | Gamma                                                        |\n| INET6                                                                                                                                                          | 1.0     | Stable                                                       |\n| InnoDB                                                                                                                                                       | 10.\\*   | Stable                                                       |\n| LOCALES                                                                                          | 1.0     | Stable                                                       |\n| Memory                                                                                                                                      | 1.0     | Stable                                                       |\n| METADATA_LOCK_INFO                                                                                                                                         | 0.1     | Stable                                                       |\n| mhnsw                                                                                                                                                                            | 1.0     | Stable                                                       |\n| MRG_MyISAM                                                                                                                                                 | 1.0     | Stable                                                       |\n| Mroonga                                                                                                                                                     | 7.7     | Stable                                                       |\n| MyISAM                                                                                                                                        | 1.0     | Stable                                                       |\n| MyRocks                                                                                                                                                     | 1.0     | Stable                                                       |\n| mysql_json                                                                                                                                                                 | 0.1     | Stable                                                       |\n| mysql_native_password                                                                                                           | 1.0     | Stable                                                       |\n| mysql_old_password                                                                                                                 | 1.0     | Stable                                                       |\n| named_pipe                                                                                                                                  | 1.0     | Stable                                                       |\n| online_alter_log                                                                                                                                                    | 2.0     | Stable                                                       |\n| pam                                                                                        | 1.0     | Stable                                                       |\n| password_reuse_check                                                                                                                       | 2.0     | <p>Stable<br>(introduced in 10.10.2, 10.9.5, and 10.8.7)</p> |\n| partition                                                                                                                                                                                                   | 1.0     | Stable                                                       |\n| Performance_Schema                                                                                                                                                | 0.1     | Stable                                                       |\n| QUERY_CACHE_INFO                                                                                                                                      | 1.1     | Stable                                                       |\n| query_response_time                                                                                                                                       | 1.0     | Stable                                                       |\n| S3                                                                                                                                                | 1.0     | Stable                                                       |\n| semisync                                                                                                                   | 1.0     | Stable                                                       |\n| Sequence                                                                                                                                  | 1.0     | Stable                                                       |\n| SERVER_AUDIT                                                                                                                                                                     | 2.6     | Stable                                                       |\n| simple_password_check                                                                                                                     | 1.0     | Stable                                                       |\n| Spider                                                                                                                                                       | 3.3     | Stable                                                       |\n| SQL_ERROR_LOG                                                                                                                  | 1.0     | Stable                                                       |\n| SYS_REFCURSOR                                                                                                         | 1.0     | Gamma                                                        |\n| TABLE_STATISTICS                                                             | 2.0     | Stable                                                       |\n| USER_STATISTICS                                                              | 2.0     | Stable                                                       |\n| user_variables                                                                                                                                                  | 1.0     | Stable                                                       |\n| TokuDB                                                                                                                                | 4.0     | <p>Stable<br>(removed in 10.6)</p>                           |\n| unix_socket                                                                                                                                | 1.1     | Stable                                                       |\n| UUID                                                                                                                                                  | 1.0     | <p>Stable<br>(introduced in 10.9.1)</p>                      |\n| uuid_v4                                                                                                                        | 1.0     | Stable                                                       |\n| uuid_v7                                                                                                                        | 1.0     | Stable                                                       |\n| wsrep                                                                                                                               | 1.0     | Stable                                                       |\n| wsrep_connections                                                                                | 1.0     | Stable                                                       |\n| WSREP_INFO                                                                                                                                    | 1.0     | Stable                                                       |\n| wsrep_provider                                                                                                                                   | 1.0     | Stable                                                       |\n| wsrep_thd_info                                                                                    | 1.0     | Stable                                                       |\n| OQGraph                                                                                                                                      | 3.0     | Gamma                                                        |\n| Sphinx                                                                                                                                        | 2.0     | Gamma                                                        |\n| Columnstore                                                                                                                         | 1.0     | Beta                                                         |\n| handlersocket                                                                                                                                                     | 1.0     | Beta                                                         |\n| Cassandra                                                                                                                          | 0.1     |\n\n[Truncated — full content at mariadb.com/docs]', '', 'https://mariadb.com/docs/server/reference/plugins/information-on-plugins/list-of-plugins');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (115, 5, 'Audit Plugin Configuration', 'Description\n-----------\n\nAfter the audit plugin has been installed and loaded, there will be some new global variables within MariaDB. These can be used to configure many components, limits, and methods related to auditing the server. You may set these variables related to the logs, such as their location, size limits, rotation parameters, and method of logging information. You may also set what information is logged, such connects, disconnects, and failed attempts to connect. You can also have the audit plugin log queries, read and write access to tables. So as not to overload your logs, the audit plugin can be configured based on lists of users. You can include or exclude the activities of specific users in the logs.\n\nTo see a list of audit plugin-related variables on the server and their values, execute the follow while connected to the server:\n\n``sql\nSHOW GLOBAL VARIABLES LIKE ''server_audit%'';\n+-------------------------------+-----------------------+\n| Variable_name                 | Value                 |\n+-------------------------------+-----------------------+\n| server_audit_events           |                       |\n| server_audit_excl_users       |                       |\n| server_audit_file_buffer_size | 0                     |\n| server_audit_file_path        | server_audit.log      |\n| server_audit_file_rotate_now  | OFF                   |\n| server_audit_file_rotate_size | 1000000               |\n| server_audit_file_rotations   | 9                     |\n| server_audit_incl_users       |                       |\n| server_audit_logging          | OFF                   |\n| server_audit_mode             | 0                     |\n| server_audit_output_type      | file                  |\n| server_audit_query_log_limit  | 1024                  |\n| server_audit_sync_log_file    | OFF                   |\n| server_audit_syslog_facility  | LOG_USER              |\n| server_audit_syslog_ident     | mysql-server_auditing |\n| server_audit_syslog_info      |                       |\n| server_audit_syslog_priority  | LOG_INFO              |\n+-------------------------------+-----------------------+\n17 rows in set (0.003 sec)\n`\n\n`sql\nSHOW GLOBAL VARIABLES LIKE ''server_audit%'';\n\n+-------------------------------+-----------------------+\n| Variable_name                 | Value                 |\n+-------------------------------+-----------------------+\n| server_audit_events           | CONNECT,QUERY,TABLE   |\n| server_audit_excl_users       |                       |\n| server_audit_file_path        | server_audit.log      |\n| server_audit_file_rotate_now  | OFF                   |\n| server_audit_file_rotate_size | 1000000               |\n| server_audit_file_rotations   | 9                     |\n| server_audit_incl_users       |                       |\n| server_audit_logging          | ON                    |\n| server_audit_mode             | 0                     |\n| server_audit_output_type      | file                  |\n| server_audit_query_log_limit  | 1024                  |\n| server_audit_syslog_facility  | LOG_USER              |\n| server_audit_syslog_ident     | mysql-server_auditing |\n| server_audit_syslog_info      |                       |\n| server_audit_syslog_priority  | LOG_INFO              |\n+-------------------------------+-----------------------+\n`\n\nThe values of these variables can be changed by an administrator with the SUPER privilege, using the SET statement. Below is an example of how to disable audit logging:\n\n`sql\nSET GLOBAL server_audit_logging=OFF;\n`\n\nAlthough it is possible to change all of the variables shown above, some of them may be reset when the server restarts. Therefore, you may want set them in the configuration file (e.g., /etc/my.cnf.d/server.cnf) to ensure the values are the same after a restart:\n\n`ini\n[server]\n... \nserver_audit_logging=OFF \n…\n`\n\nFor the reason given in the paragraph above, you would not generally set variables related to the auditing plugin using the SET statement. However, you might do so to test settings before making them more permanent. Since one cannot always restart the server, you would use the SET` statement to change immediately the variables and then include the same settings in the configuration file so that the variables are set again as you prefer when the server is restarted.\n\nConfiguring Logs and Setting Other Variables\n\nOf all of the server variables you can set, you may want to set initially the server_audit_events variable to tell the Audit Plugin which events to log. The Log Settings documentation page describes in detail the choices you have and provides examples of log entries related to them.\n\nYou can see a detailed list of system variables related to the MariaDB Audit Plugin on the System Variables documentation page. Status variables related to the Audit Plugin are listed and explained on the Status Variables documentation page.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-configuration', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-configuration');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (116, 5, 'Audit Plugin Installation', 'Description\n-----------\n\nThe server_audit plugin logs the server''s activity. For each client session, it records who connected to the server (i.e., user name and host), what queries were executed, and which tables were accessed and server variables that were changed. This information is stored in a rotating log file or it may be sent to the local syslogd.\n\nLocating the Plugin\n\nThe server_audit plugin''s shared library is included in MariaDB packages as the server_audit.so or server_audit.dll shared library on systems where it can be built.\n\nThe plugin must be located in the plugin directory, the directory containing all plugin libraries for MariaDB. The path to this directory is configured by the plugin_dir system variable. To see the value of this variable and thereby determine the file path of the plugin library, execute the following SQL statement:\n\n``sql\nSHOW GLOBAL VARIABLES LIKE ''plugin_dir'';\n\n+---------------+--------------------------+\n| Variable_name | Value                    |\n+---------------+--------------------------+\n| plugin_dir    | /usr/lib64/mysql/plugin/ |\n+---------------+--------------------------+\n`\n\nCheck the directory returned at the filesystem level to make sure that you have a copy of the plugin library, server_audit.so or server_audit.dll, depending on your system. It''s included in recent installations of MariaDB. If you do not have it, you should upgrade MariaDB.\n\nInstalling the Plugin\n\nAlthough the plugin''s shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.\n\nThe first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:\n\n`sql\nINSTALL SONAME ''server_audit'';\n`\n\nThe second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be specified as a command-line argument to mariadbd , or it can be specified in a relevant server option group in an option file:\n\n`ini\n[mariadb]\n...\nplugin_load_add = server_audit\n`\n\nUninstalling the Plugin\n\nYou can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:\n\n`sql\nUNINSTALL SONAME ''server_audit'';\n`\n\nIf you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.\n\nProhibiting Uninstallation\n\nThe UNINSTALL SONAME or UNINSTALL PLUGIN statements may be used to uninstall plugins. For the server_audit plugin, you might want to disable this capability. To prevent the plugin from being uninstalled, you could set the server_audit option to FORCE_PLUS_PERMANENT in a relevant server option group in an option file after the plugin is loaded once:\n\n`ini\n[mariadb]\n...\nplugin_load_add = server_audit\nserver_audit=FORCE_PLUS_PERMANENT\n`\n\nOnce you''ve added the option to the server''s option file and restarted the server, the plugin can''t be uninstalled. If someone tries to uninstall the audit plugin, then an error message will be returned. Below is an example of the error message:\n\n`sql\nUNINSTALL PLUGIN server_audit;\n\nERROR 1702 (HY000):\nPlugin ''server_audit'' is force_plus_permanent and can not be unloaded\n`\n\nFor more information on FORCE_PLUS_PERMANENT` and other option values for the server_audit option, see Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-installation', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-installation');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (117, 5, 'Audit Plugin Location and Rotation of Logs', 'Description\n-----------\n\nLogs can be written to a separate file or to the system logs. If you prefer to have the logging separated from other system information, the value of the variable server_audit_output_type should be set to file. Incidentally, file is the only option on Windows systems.\n\nYou can force a rotation by enabling the server_audit_file_rotate_now variable like so:\n\n``sql\nSET GLOBAL server_audit_file_rotate_now = ON;\n`\n\nSeparate log files\n\nIn addition to setting server_audit_output_type, you will have to provide the file path and name of the audit file. This is set in the variable server_audit_file_path. You can set the file size limit of the log file with the variable server_audit_file_rotate_size.\n\nSo, if rotation is on and the log file has reached the size limit you set, a copy is created with a consecutive number as extension the original file will be truncated to be used for the auditing again. To limit the number of log files created, set the variable server_audit_file_rotations. You can force log file rotation by setting the variable server_audit_file_rotate_now to a value of ON. When the number of files permitted is reached, the oldest file will be overwritten. Here is how those variables might be set in a server configuration file:\n\n`ini\n[mysqld]\n...\nserver_audit_file_rotate_now=ON \nserver_audit_file_rotate_size=1000000 \nserver_audit_file_rotations=5\n...\n`\n\nSystem logs\n\nFor security reasons, it''s better sometimes to use the system logs instead of a local file owned by the mysql user. To do this, the value of server_audit_output_type needs to be set to syslog. Advanced configurations, such as using a remote syslogd service, are part of the syslogd configuration.\n\nThe variables, server_audit_syslog_ident and server_audit_syslog_info can be used to identify a system log entry made by the audit plugin. If a remote syslogd service is used for several MariaDB servers, these same variables are also used to identify the MariaDB server.\n\nHere is a system log entry taken from a server which had server_audit_syslog_ident set to the default value of mysql­-server_auditing, and server_audit_syslog_info set to <prod1>.\n\n`sql\nAug 717:19:58localhostmysql-­server_auditing: \n<prod1> localhost.localdomain,root,localhost,1,7, \nQUERY, mysql, ''SELECT * FROM user'',0\n`\n\nAlthough the default values for server_audit_syslog_facility and server_audit_syslog_priority should be sufficient in most cases. They can be changed based on the definition in syslog.h for the functions openlog() and syslog()`.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-location-and-rotation-of-logs', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-location-and-rotation-of-logs');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (118, 5, 'Audit Plugin Log Format', 'Description\n-----------\n\nThe audit plugin logs user access to MariaDB and its objects. The audit trail (that is, the audit log) is a set of records, written as a list of fields to a file in a plain‐text format. The fields in the log are separated by commas. The format used for the plugin''s own log file is slightly different from the format used if it logs to the system log because it has its own standard format.&#x20;\n\nFormal Specification\n\nWhen the MariaDB Audit Plugin (v1) writes to a dedicated file, it uses a comma-separated (CSV) format. For tool developers, it is essential to map the connectionid to the server''s global connection identifier to enable cross-log analysis.\n\nTemplate: <timestamp>,<serverhost>,<username>,<host>,<connectionid>,<queryid>,<operation>,<database>,<object>,<retcode>\n\n| Field | Component      | Data Type      | Standardized Name / Description                                                                                                              |\n| ----- | -------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |\n| 1     | timestamp    | DateTime     | Formatted as %Y%m%d %H:%i:%s (the default), or as specified in server_audit_timestamp_format. |\n| 2     | serverhost   | String       | Hostname of the originating server.                                                                                                          |\n| 5     | connectionid | Unsigned Int | Standardized: Thread ID. Matches the Thread ID in Error, General, and Slow logs.                                                           |\n| 6     | queryid      | Unsigned Int | A unique identifier for the specific query, used to correlate QUERY and TABLE events.                                                    |\n| 7     | operation    | String       | Action type (e.g., CONNECT, QUERY, READ, WRITE).                                                                                     |\n| 10    | retcode      | Integer      | Result code (0 for success).                                                                                                               |\n\nAudit Log Format with Syslog\n\nIf server_audit_output_type is set to SYSLOG, the standard CSV line is prefixed with syslog metadata: <timestamp> <syslog_host> <syslog_ident>: <syslog_info> [Standard CSV Fields]\n\nVarious events result in different audit records. Some events do not return a value for some fields (for instance, when the active database is not set when connecting to the server).\n\nBelow is a generic example of the output for connect events, with placeholders representing data. These are events in which a user connected, disconnected, or tried unsuccessfully to connect to the server.\n\n``ini\n[timestamp],[serverhost],[username],[host],[connectionid],0,CONNECT,[database],,0 \n[timestamp],[serverhost],[username],[host],[connectionid],0,DISCONNECT,,,0 \n[timestamp],[serverhost],[username],[host],[connectionid],0,FAILED_CONNECT,,,[retcode]\n`\n\nHere is the one audit record generated for each query event:\n\n`ini\n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],QUERY,[database],[object], [retcode]\n`\n\nBelow are generic examples of records that are entered in the audit log for each type of table event:\n\n`ini\n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],CREATE,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],READ,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],WRITE,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],ALTER,[database],[object], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],RENAME,[database], \n[object_old]|[database_new].[object_new], \n[timestamp],[serverhost],[username],[host],[connectionid],[queryid],DROP,[database],[object],\n`\n\nPasswords are hidden in the log for certain types of queries. They are replaced with asterisks for GRANT, CREATE USER, CREATE MASTER, CREATE SERVER, and ALTER SERVER statements. Passwords, however, are not replaced for the PASSWORD() and OLD_PASSWORD() functions when they are used inside other SQL statements (i.e., SET PASSWORD).\n\nFor Galera Cluster replication applier operations, audit log plugin logs events with a generic name of <wsrep_applier>` .\n\nThis addresses an issue where the user was logged on the primary node, but stripped from other cluster nodes. See MDEV-35511 for details.\n\nFor Galera Cluster replication applier operations, audit log plugin logs events without indicating what user initiates them.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-format', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-format');
INSERT INTO help_topic (help_topic_id, help_category_id, name, description, example, url) VALUES (119, 5, 'Audit Plugin Log Settings', 'Description\n-----------\n\nEvents that are logged by the MariaDB Audit Plugin are grouped generally into different types: connect, query, and table events. To log based on these types of events, set the variable, server_audit_events to CONNECT, QUERY, or TABLE. To have the Audit Plugin log more than one type of event, put them in a comma-separated list like so:\n\n``sql\nSET GLOBAL server_audit_events = ''CONNECT,QUERY,TABLE'';\n`\n\nYou can put the equivalent of this in the configuration file like so:\n\n`ini\n[mysqld]\n...\nserver_audit_events=connect,query\n`\n\nBy default, logging is set to OFF. To enable it, set the server_audit_logging variable to ON. Note that if the query cache is enabled, and a query is returned from the query cache, no TABLE records will appear in the log since the server didn''t open or access any tables and instead relied on the cached results. So you may want to disable query caching.\n\nThere are a few types of events that may be logged, not just the three common ones mentioned above. A full list of related system variables is detailed on the Server_Audit System Variables page, and status variables on the Server_Audit System Variables page of this documentation. Some of the major ones are highlighted below:\n\n| Type                   | Description                                                                                                                                                                                                                               |\n| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| CONNECT                | Connects, disconnects and failed connects—including the error code.                                                                                                                                                                       |\n| QUERY                  | Queries executed and their results in plain text, including failed queries due to syntax or permission errors.                                                                                                                            |\n| TABLE                  | Tables affected by query execution.                                                                                                                                                                                                       |\n| QUERY_DDL             | Similar to QUERY, but filters only DDL-type queries (CREATE, ALTER, DROP, RENAME and TRUNCATE). There are some exceptions however. RENAME USER is not logged, while CREATE/DROP [PROCEDURE / FUNCTION / USER] are logged. |\n| QUERY_DML             | Similar to QUERY, but filters only DML-type queries (DO, CALL, LOAD DATA/XML, DELETE, INSERT, SELECT, UPDATE, HANDLER , and REPLACE statements).                                                                      |\n| QUERY_DML_NO_SELECT | Similar to QUERY_DML, but doesn''t log SELECT queries.                                                                                                                                                                                 |\n| QUERY_DCL             | Similar to QUERY, but filters only DCL-type queries (CREATE USER, DROP USER, RENAME USER, GRANT, REVOKE and SET PASSWORD statements).                                                                                       |\n\nSince there are other types of queries besides DDL and DML, using the QUERY_DDL and QUERY_DML options together is not equivalent to using QUERY. There is the QUERY_DCL option for logging DCL types of queries (e.g., and GRANT`REVOKEstatements). In the same version, the server_audit_query_log_limit variable was added to be able to set the length of a log record. Previously, a log entry would be truncated due to long query strings.\n\nLogging Connect Events\n\nIf the Audit Plugin has been configured to log connect events, it will log connects, disconnects, and failed connects. For a failed connection, the log includes the error code.\n\nIt''s possible to define a list of users for which events can be excluded or included for tracing their database activities. This list will be ignored, though, for the logging of connect events. This is because auditing standards distinguish between technical and physical users. Connects need to be logged for all types of users; access to objects needs to be logged only for physical users.\n\nLogging Query Events\n\nIf QUERY, QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, and/or QUERY_DCL event types are enabled, then the corresponding types of queries that are executed will be logged for defined users. The queries will be logged exactly as they are executed, in plain text. This is a security vulnerability: anyone who has access to the log files will be able to read the queries. So make sure that only trusted users have access to the log files and that the files are in a protected location. An alternative is to use the⁣TABLE event type instead of the query-related event types.\n\nQueries are also logged if they cannot be executed or if they''re unsuccessful. For example, a query will be logged because of a syntax error or because the user doesn''t have the privileges necessary to access an object. These queries can be parsed by the error code that''s provided in the log.\n\nYou may find failed queries to be more interesting: They can reveal problems with applications (e.g., an SQL statement in an application that doesn''t match the current schema). They can also reveal if a malicious user is guessing at the names of tables and columns to try to get access to data.\n\nBelow is an example in which a user attempts to execute an UPDATE statement on a table for which he does not have permission:\n\n``sql\nUPDATE employees \nSET salary = salary  1.2 \nWHERE emp_id = 18236;\n\nERROR 1142 (42000): \nUPDATE command denied to user ''bob''@''localhost'' for table ''employees''\n`\n\nLooking in the Audit Plugin log (server_audit.log) for this entry, you can see the following entry:\n\n`sql\n20170817 11:07:18,ip-172-30-0-38,bob,localhost,15,46,QUERY,company,''UPDATE employees SET salary = salary  1.2 WHERE emp_id = 18236'',1142\n`\n\nThis log entry contains the date and time of the query, followed by the server host, and the user and host for the account.\n\nFrom MariaDB 12.0, in addition to the host, the audit log also contains the port, where applicable (for instance, connecting via a Unix socket doesn''t use a port).\n\nNext is the connection and query identification numbers (i.e., 15 and 46). After the log event type (i.e., QUERY), the database name (i.e., company), the query, and the error number are recorded.\n\nNotice that the last value in the log entry is 1142. That''s the error number for the query. To find failed queries, you would look for two elements: the notation indicating that it''s an entry QUERY and the last value for the entry. If the query is successful, the value will be0 .\n\nQueries Not Included in Subordinate Query Event Types\n\nNote that the QUERY event type will log queries that are not included in any of the subordinate QUERY_ event types, such as:\n\n CREATE FUNCTION\n DROP FUNCTION\n CREATE PROCEDURE\n DROP PROCEDURE\n SET\n CHANGE MASTER TO\n FLUSH\n KILL\n CHECK\n OPTIMIZE\n LOCK\n UNLOCK\n ANALYZE\n INSTALL PLUGIN\n UNINSTALL PLUGIN\n INSTALL SONAME\n UNINSTALL SONAME\n EXPLAIN\n\nLogging Table Events\n\nMariaDB has the ability to record table events in the logs—this is not a feature of MySQL. This feature is the only way to log which tables have been accessed through a view, a stored procedure, a stored function, or a trigger. Without this feature, a log entry for a query shows only the view, stored procedure or function used, not the underlying tables. Of course, you could create a custom application to parse each query executed to find the SQL statements used and the tables accessed, but that would be a drain on system resources. Table event logging is much simpler: it adds a line to the log for each table accessed, without any parsing. It includes notes as to whether it was a read or a write.\n\nIf you want to monitor user access to specific databases or tables (e.g., mysql.user), you can search the log for them. Then if you want to see a query which accessed a certain table, the audit log entry will include the query identification number. You can use it to search the same log for the query entry. This can be useful when searching a log containing tens of thousands of entries.\n\nBecause of the TABLE option, you may disable query logging and still know who accessed which tables. You might want to disable QUERY event logging to prevent sensitive data from being logged. Since _table_ event logging will log who accessed which table, you can still watch for malicious activities with the log. This is often enough to fulfill auditing requirements.\n\nBelow is an example with both TABLE and QUERY events logging. For this scenario, suppose there is a VIEW in which columns are selected from a few tables in a company database. The underlying tables are related to sensitive employee information, in particular salaries. Although we may have taken precautions to ensure that only certain user accounts have access to those tables, we will monitor the Audit Plugin logs for anyone who queries them—directly or indirectly through a view.\n\n`\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,employees,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,employees_salaries,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,ref_job_titles,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,READ,company,org_departments,\n20170817 16:04:33,ip-172-30-0-38,root,localhost,29,913,QUERY,company,\n''SELECT  FROM employee_pay WHERE title LIKE \\''%Executive%\\''  OR title LIKE \\''%Manager%\\'''',0\n`\n\nAlthough the user executed only one SELECT statement, there are multiple entries to the log: one for each table accessed and one entry for the query on the view, (i.e., employee_pay). We know primarily this is all for one query because they all have the same connection and query identification numbers (i.e., 29 and 913).\n\nLogging User Activities\n\nThe Audit Plugin will log the database activities of all users, or only the users that you specify. A database activity is defined as a _query_ event or a _table_ event. _Connect_ events are logged for all users.\n\nYou may specify users to include in the log with the server_audit_incl_users variable or exclude users with the server_audit_excl_users variable. This can be useful if you would like to log entries, but are not interested in entries from trusted applications and would like to exclude them from the logs.\n\nYou would typically use either the server_audit_incl_users variable or the server_audit_excl_users variable. You may, though, use both variables. If a username is inadvertently listed in both variables, database activities for that user will be logged because server_audit_incl_users takes priority.\n\nAlthough MariaDB considers a user as the combination of the username and hostname, the Audit Plugin logs only based on the username. MariaDB uses both the username and hostname so as to grant privileges relevant to the location of the user. Privileges are not relevant though for tracing the access to database objects. The host name is still recorded in the log, but logging is not determined based on that information.\n\nThe following example shows how to add a new username to the server_audit_incl_users variable without removing previous usernames:\n\n`sql\nSET GLOBAL server_audit_incl_users = CONCAT(@@global.server_audit_incl_users, '',Maria'');\n`\n\nRemember to add also any new users to be included in the logs to the same variable in MariaDB configuration file. Otherwise, when the server restarts it will discard the setting.\n\nExcluding or Including Users\n\nBy default events from all users are logged, but certain users can be excluded from logging by using the server_audit_excl_users variable. For example, to exclude users _valerianus_ and _rocky_ from having their events logged:\n\n`ini\nserver_audit_excl_users=valerianus,rocky\n`\n\nThis option is primarily used to exclude the activities of trusted applications.\n\nAlternatively, server_audit_incl_users can be used to specifically include users. Both variables can be used, but if a user appears on both lists, server_audit_incl_users has a higher priority, and their activities will be logged.\n\nNote that CONNECT` events are always logged for all users, regardless of these two settings. Logging is also based on username only, not the username and hostname combination that MariaDB uses to determine privileges.\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-settings', '', 'https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-log-settings');
