-- Copyright (c) 2007, 2018, Oracle and/or its affiliates. -- Copyright (c) 2008, 2019, MariaDB Corporation. -- -- 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 St, Fifth Floor, Boston, MA 02110-1335 USA
-- -- The system tables of MySQL Server --
SET NAMES latin1 COLLATE latin1_swedish_ci;
set sql_mode='';
set @orig_storage_engine=@@default_storage_engine; set default_storage_engine=Aria;
set system_versioning_alter_history=keep;
set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB'and support != 'NO'); SET @innodb_or_aria=IF(@have_innodb <> 0, 'InnoDB', 'Aria');
CREATETABLEIFNOTEXISTS time_zone_transition ( Time_zone_id intunsignedNOTNULL, Transition_time bigint signed NOTNULL, Transition_type_id intunsignedNOTNULL, PRIMARYKEY/*TzIdTranTime*/ (Time_zone_id, Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment='Time zone transitions';
CREATETABLEIFNOTEXISTS time_zone_transition_type ( Time_zone_id intunsignedNOTNULL, Transition_type_id intunsignedNOTNULL, `Offset` int signed DEFAULT0NOTNULL, Is_DST tinyintunsignedDEFAULT0NOTNULL, Abbreviation char(8) DEFAULT''NOTNULL, PRIMARYKEY/*TzIdTrTId*/ (Time_zone_id, Transition_type_id) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment='Time zone transition types';
CREATETABLEIFNOTEXISTS time_zone_leap_second ( Transition_time bigint signed NOTNULL, Correction int signed NOTNULL, PRIMARYKEY/*TranTime*/ (Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment='Leap seconds information for time zones';
-- Create general_log if CSV is enabled. SET @have_csv = 'YES'=(SELECT support FROM information_schema.engines WHERE engine = 'CSV'); SET @str = IF (@have_csv, 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, user_host MEDIUMTEXT NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment="General log"', 'SET @dummy = 0');
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
-- Create slow_log if CSV is enabled.
SET @str = IF (@have_csv, 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, user_host MEDIUMTEXT NOT NULL, query_time TIME(6) NOT NULL, lock_time TIME(6) NOT NULL, rows_sent BIGINT UNSIGNED NOT NULL, rows_examined BIGINT UNSIGNED NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL, rows_affected BIGINT UNSIGNED NOT NULL) engine=CSV CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment="Slow log"', 'SET @dummy = 0');
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
SET @create_innodb_index_stats="CREATE TABLE IF NOT EXISTS innodb_index_stats (
database_name VARCHAR(64) NOTNULL,
table_name VARCHAR(199) NOTNULL,
index_name VARCHAR(64) NOTNULL,
last_update TIMESTAMP NOTNULLDEFAULTCURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP, /* there are at least: stat_name='size' stat_name='n_leaf_pages'
stat_name='n_diff_pfx%' */
stat_name VARCHAR(64) NOTNULL,
stat_value BIGINTUNSIGNEDNOTNULL,
sample_size BIGINTUNSIGNED,
stat_description VARCHAR(1024) NOTNULL, PRIMARYKEY (database_name, table_name, index_name, stat_name)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0";
SET @create_transaction_registry="CREATE TABLE IF NOT EXISTS transaction_registry (
transaction_id BIGINTUNSIGNEDNOTNULL,
commit_id BIGINTUNSIGNEDNOTNULL,
begin_timestamp TIMESTAMP(6) NOTNULLDEFAULT'0000-00-00 00:00:00.000000',
commit_timestamp TIMESTAMP(6) NOTNULLDEFAULT'0000-00-00 00:00:00.000000',
isolation_level ENUM('READ-UNCOMMITTED', 'READ-COMMITTED', 'REPEATABLE-READ', 'SERIALIZABLE') NOTNULL, PRIMARYKEY (transaction_id), UNIQUEKEY (commit_id), INDEX (begin_timestamp), INDEX (commit_timestamp, transaction_id)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0";
SET @str=IF(@have_innodb <> 0, @create_innodb_table_stats, "SET @dummy = 0");
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
SET @str=IF(@have_innodb <> 0, @create_innodb_index_stats, "SET @dummy = 0");
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
SET @str=IF(@have_innodb <> 0, @create_transaction_registry, "SET @dummy = 0");
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
SET @cmd="CREATE TABLE IF NOT EXISTS slave_relay_log_info (
Number_of_lines INTEGERUNSIGNEDNOTNULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
Relay_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL COMMENT 'The name of the current relay log file.',
Relay_log_pos BIGINTUNSIGNEDNOTNULL COMMENT 'The relay log position of the last executed event.',
Master_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
Master_log_pos BIGINTUNSIGNEDNOTNULL COMMENT 'The master log position of the last executed event.',
Sql_delay INTEGERNOTNULL COMMENT 'The number of seconds that the slave must lag behind the master.',
Number_of_workers INTEGERUNSIGNEDNOTNULL,
Id INTEGERUNSIGNEDNOTNULL COMMENT 'Internal Id that uniquely identifies this record.', PRIMARYKEY(Id)) DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 COMMENT 'Relay Log Information'";
SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_aria); -- Don't create the table; MariaDB will have another implementation
#PREPARE stmt FROM @str;
#EXECUTE stmt;
#DROP PREPARE stmt;
SET @cmd= "CREATE TABLE IF NOT EXISTS slave_master_info (
Number_of_lines INTEGERUNSIGNEDNOTNULL COMMENT 'Number of lines in the file.',
Master_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL COMMENT 'The name of the master binary log currently being read from the master.',
Master_log_pos BIGINTUNSIGNEDNOTNULL COMMENT 'The master log position of the last read event.',
Host CHAR(255) CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The host name of the master.',
User_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The user name used to connect to the master.',
User_password TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The password used to connect to the master.',
Port INTEGERUNSIGNEDNOTNULL COMMENT 'The network port used to connect to the master.',
Connect_retry INTEGERUNSIGNEDNOTNULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
Enabled_ssl BOOLEAN NOTNULL COMMENT 'Indicates whether the server supports SSL connections.',
Ssl_ca TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
Ssl_capath TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
Ssl_cert TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The name of the SSL certificate file.',
Ssl_cipher TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The name of the cipher in use for the SSL connection.',
Ssl_key TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The name of the SSL key file.',
Ssl_verify_server_cert BOOLEAN NOTNULL COMMENT 'Whether to verify the server certificate.',
Heartbeat FLOATNOTNULL COMMENT '',
Bind TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
Ignored_server_ids TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
Uuid TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The master server uuid.',
Retry_count BIGINTUNSIGNEDNOTNULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
Ssl_crl TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
Ssl_crlpath TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
Enabled_auto_position BOOLEAN NOTNULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.', PRIMARYKEY(Host, Port)) DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 COMMENT 'Master Information'";
SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_aria); -- Don't create the table; MariaDB will have another implementation
#PREPARE stmt FROM @str;
#EXECUTE stmt;
#DROP PREPARE stmt;
SET @cmd= "CREATE TABLE IF NOT EXISTS slave_worker_info (
Id INTEGERUNSIGNEDNOTNULL,
Relay_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL,
Relay_log_pos BIGINTUNSIGNEDNOTNULL,
Master_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL,
Master_log_pos BIGINTUNSIGNEDNOTNULL,
Checkpoint_relay_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL,
Checkpoint_relay_log_pos BIGINTUNSIGNEDNOTNULL,
Checkpoint_master_log_name TEXT CHARACTERSET utf8mb3 COLLATE utf8mb3_bin NOTNULL,
Checkpoint_master_log_pos BIGINTUNSIGNEDNOTNULL,
Checkpoint_seqno INTUNSIGNEDNOTNULL,
Checkpoint_group_size INTEGERUNSIGNEDNOTNULL,
Checkpoint_group_bitmap BLOBNOTNULL, PRIMARYKEY(Id)) DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 COMMENT 'Worker Information'";
SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_aria); -- Don't create the table; MariaDB will have another implementation
#PREPARE stmt FROM @str;
#EXECUTE stmt;
#DROP PREPARE stmt;
-- Remember for later if proxies_priv table already existed set @had_proxies_priv_table= @@warning_count != 0;
-- The following needs to be done both for new installations -- and for upgrades CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv; INSERTINTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now()); REPLACEINTO tmp_proxies_priv SELECT'localhost',IFNULL(@auth_root_socket, 'root'), '', '', TRUE, '', now() FROMDUAL; INSERTINTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0; DROPTABLE tmp_proxies_priv;
-- Note: This definition must be kept in sync with the one used in -- build_gtid_pos_create_query() in sql/slave.cc SET @cmd= "CREATE TABLE IF NOT EXISTS gtid_slave_pos (
domain_id INTUNSIGNEDNOTNULL,
sub_id BIGINTUNSIGNEDNOTNULL,
server_id INTUNSIGNEDNOTNULL,
seq_no BIGINTUNSIGNEDNOTNULL, PRIMARYKEY (domain_id, sub_id)) CHARSET=latin1
COMMENT='Replication slave GTID position'"; SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_aria);
PREPARE stmt FROM @str;
EXECUTE stmt; DROP PREPARE stmt;
set default_storage_engine=@orig_storage_engine;
-- -- Drop some tables not used anymore in MariaDB --
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.