CREATETABLEIFNOTEXISTSuser(Hostchar(60)binaryDEFAULT''NOTNULL,Userchar(16)binaryDEFAULT''NOTNULL,Passwordchar(41)charactersetlatin1collatelatin1_binDEFAULT''NOTNULL,Select_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Insert_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Update_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Delete_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Drop_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Reload_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Shutdown_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Process_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,File_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Grant_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,References_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Index_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Alter_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Show_db_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Super_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_tmp_table_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Lock_tables_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Execute_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Repl_slave_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Repl_client_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_view_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Show_view_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_routine_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Alter_routine_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_user_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Event_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Trigger_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,Create_tablespace_privenum('N','Y')COLLATEutf8_general_ciDEFAULT'N'NOTNULL,ssl_typeenum('','ANY','X509','SPECIFIED')COLLATEutf8_general_ciDEFAULT''NOTNULL,ssl_cipherBLOBNOTNULL,x509_issuerBLOBNOTNULL,x509_subjectBLOBNOTNULL,max_questionsint(11)unsignedDEFAULT0NOTNULL,max_updatesint(11)unsignedDEFAULT0NOTNULL,max_connectionsint(11)unsignedDEFAULT0NOTNULL,max_user_connectionsint(11)DEFAULT0NOTNULL,pluginchar(64)CHARACTERSETlatin1DEFAULT''NOTNULL,authentication_stringTEXTNOTNULL,PRIMARYKEYHost(Host,User))engine=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Users and global privileges';
CREATETABLEIFNOTEXISTSfunc(namechar(64)binaryDEFAULT''NOTNULL,rettinyint(1)DEFAULT'0'NOTNULL,dlchar(128)DEFAULT''NOTNULL,typeenum('function','aggregate')COLLATEutf8_general_ciNOTNULL,PRIMARYKEY(name))engine=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='User defined functions';
CREATETABLEIFNOTEXISTStime_zone_name(Namechar(64)NOTNULL,Time_zone_idintunsignedNOTNULL,PRIMARYKEYName(Name))engine=MyISAMCHARACTERSETutf8comment='Time zone names';
CREATETABLEIFNOTEXISTStime_zone_transition(Time_zone_idintunsignedNOTNULL,Transition_timebigintsignedNOTNULL,Transition_type_idintunsignedNOTNULL,PRIMARYKEYTzIdTranTime(Time_zone_id,Transition_time))engine=MyISAMCHARACTERSETutf8comment='Time zone transitions';
CREATETABLEIFNOTEXISTStime_zone_transition_type(Time_zone_idintunsignedNOTNULL,Transition_type_idintunsignedNOTNULL,OffsetintsignedDEFAULT0NOTNULL,Is_DSTtinyintunsignedDEFAULT0NOTNULL,Abbreviationchar(8)DEFAULT''NOTNULL,PRIMARYKEYTzIdTrTId(Time_zone_id,Transition_type_id))engine=MyISAMCHARACTERSETutf8comment='Time zone transition types';
CREATETABLEIFNOTEXISTStime_zone_leap_second(Transition_timebigintsignedNOTNULL,CorrectionintsignedNOTNULL,PRIMARYKEYTranTime(Transition_time))engine=MyISAMCHARACTERSETutf8comment='Leap seconds information for time zones';
SET@str=IF(@@have_csv='YES','CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP(6) NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"','SET @dummy = 0');
SET@str=IF(@@have_csv='YES','CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP(6) NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME(6) NOT NULL, lock_time TIME(6) NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER 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) engine=CSV CHARACTER SET utf8 comment="Slow log"','SET @dummy = 0');
CREATETABLEIFNOTEXISTSslave_relay_log_info(Master_idINTEGERUNSIGNEDNOTNULL,Number_of_linesINTEGERUNSIGNEDNOTNULLCOMMENT'Number of lines in the file or rows in the table. Used to version table definitions.',Relay_log_nameTEXTCHARACTERSETutf8COLLATEutf8_binNOTNULLCOMMENT'The name of the current relay log file.',Relay_log_posBIGINTUNSIGNEDNOTNULLCOMMENT'The relay log position of the last executed event.',Master_log_nameTEXTCHARACTERSETutf8COLLATEutf8_binNOTNULLCOMMENT'The name of the master binary log file from which the events in the relay log file were read.',Master_log_posBIGINTUNSIGNEDNOTNULLCOMMENT'The master log position of the last executed event.',Sql_delayINTEGERNOTNULLCOMMENT'The number of seconds that the slave must lag behind the master.',Number_of_workersINTEGERUNSIGNEDNOTNULL,PRIMARYKEY(Master_id))ENGINE=MYISAMDEFAULTCHARSET=utf8COMMENT'Relay Log Information';
CREATETABLEIFNOTEXISTSslave_master_info(Master_idINTEGERUNSIGNEDNOTNULL,Number_of_linesINTEGERUNSIGNEDNOTNULLCOMMENT'Number of lines in the file.',Master_log_nameTEXTCHARACTERSETutf8COLLATEutf8_binNOTNULLCOMMENT'The name of the master binary log currently being read from the master.',Master_log_posBIGINTUNSIGNEDNOTNULLCOMMENT'The master log position of the last read event.',HostTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The host name of the master.',User_nameTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The user name used to connect to the master.',User_passwordTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The password used to connect to the master.',PortINTEGERUNSIGNEDNOTNULLCOMMENT'The network port used to connect to the master.',Connect_retryINTEGERUNSIGNEDNOTNULLCOMMENT'The period (in seconds) that the slave will wait before trying to reconnect to the master.',Enabled_sslBOOLEANNOTNULLCOMMENT'Indicates whether the server supports SSL connections.',Ssl_caTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The file used for the Certificate Authority (CA) certificate.',Ssl_capathTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The path to the Certificate Authority (CA) certificates.',Ssl_certTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The name of the SSL certificate file.',Ssl_cipherTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The name of the cipher in use for the SSL connection.',Ssl_keyTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The name of the SSL key file.',Ssl_verify_server_certBOOLEANNOTNULLCOMMENT'Whether to verify the server certificate.',HeartbeatFLOATNOTNULLCOMMENT'',BindTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'Displays which interface is employed when connecting to the MySQL server',Ignored_server_idsTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The number of server IDs to be ignored, followed by the actual server IDs',UuidTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The master server uuid.',Retry_countBIGINTUNSIGNEDNOTNULLCOMMENT'Number of reconnect attempts, to the master, before giving up.',Ssl_crlTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The file used for the Certificate Revocation List (CRL)',Ssl_crlpathTEXTCHARACTERSETutf8COLLATEutf8_binCOMMENT'The path used for Certificate Revocation List (CRL) files',PRIMARYKEY(Master_id))ENGINE=MYISAMDEFAULTCHARSET=utf8COMMENT'Master Information';
CREATETABLEIFNOTEXISTStable_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,cardinalitybigint(21)unsignedDEFAULTNULL,PRIMARYKEY(db_name,table_name))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Tables';
CREATETABLEIFNOTEXISTScolumn_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,column_namevarchar(64)NOTNULL,min_valuevarchar(255)DEFAULTNULL,max_valuevarchar(255)DEFAULTNULL,nulls_ratiodecimal(12,4)DEFAULTNULL,avg_lengthdecimal(12,4)DEFAULTNULL,avg_frequencydecimal(12,4)DEFAULTNULL,PRIMARYKEY(db_name,table_name,column_name))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Columns';
CREATETABLEIFNOTEXISTSindex_stats(db_namevarchar(64)NOTNULL,table_namevarchar(64)NOTNULL,index_namevarchar(64)NOTNULL,prefix_arityint(11)unsignedNOTNULL,avg_frequencydecimal(12,4)DEFAULTNULL,PRIMARYKEY(db_name,table_name,index_name,prefix_arity))ENGINE=MyISAMCHARACTERSETutf8COLLATEutf8_bincomment='Statistics on Indexes';