1/*
2 Do not edit this file, it is automatically generated from:
3 <mysql_fix_privilege_tables.sql>
4*/
5#include <stdlib.h>
6const char* mysql_fix_privilege_tables[]={
7"set sql_mode='';\n",
8"set @orig_storage_engine=@@storage_engine;\n",
9"set storage_engine=myisam;\n",
10"set system_versioning_alter_history=keep;\n",
11"set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');\n",
12"SET @innodb_or_myisam=IF(@have_innodb <> 0, 'InnoDB', 'MyISAM');\n",
13"CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';\n",
14"set @had_db_table= @@warning_count != 0;\n",
15"CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';\n",
16"CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) DEFAULT 0 NOT NULL, plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, default_role char(80) binary DEFAULT '' NOT NULL, max_statement_time decimal(12,6) DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';\n",
17"set @had_user_table= @@warning_count != 0;\n",
18"CREATE TABLE IF NOT EXISTS roles_mapping ( Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Role char(80) binary DEFAULT '' NOT NULL, Admin_option enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, UNIQUE (Host, User, Role)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Granted roles';\n",
19"CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';\n",
20"CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';\n",
21"CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(80) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';\n",
22"CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';\n",
23"CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';\n",
24"CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';\n",
25"CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';\n",
26"CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';\n",
27"CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';\n",
28"CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';\n",
29"CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';\n",
30"CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';\n",
31"CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';\n",
32"CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';\n",
33"CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL', 'SIMULTANEOUS_ASSIGNMENT') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';\n",
34"CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';\n",
35"SET @have_csv = (SELECT support FROM information_schema.engines WHERE engine = 'CSV');\n",
36"SET @str = IF (@have_csv = 'YES', '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 utf8 comment=\"General log\"', 'SET @dummy = 0');\n",
37"PREPARE stmt FROM @str;\n",
38"EXECUTE stmt;\n",
39"DROP PREPARE stmt;\n",
40"SET @str = IF (@have_csv = 'YES', '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 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, thread_id BIGINT(21) UNSIGNED NOT NULL, rows_affected INTEGER NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"Slow log\"', 'SET @dummy = 0');\n",
41"PREPARE stmt FROM @str;\n",
42"EXECUTE stmt;\n",
43"DROP PREPARE stmt;\n",
44"CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';\n",
45"SET @create_innodb_table_stats=\"CREATE TABLE IF NOT EXISTS innodb_table_stats (\n"
46 " database_name VARCHAR(64) NOT NULL,\n"
47 " table_name VARCHAR(64) NOT NULL,\n"
48 " last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n"
49 " n_rows BIGINT UNSIGNED NOT NULL,\n"
50 " clustered_index_size BIGINT UNSIGNED NOT NULL,\n"
51 " sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL,\n"
52 " PRIMARY KEY (database_name, table_name)\n"
53 ") ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0\";\n",
54"SET @create_innodb_index_stats=\"CREATE TABLE IF NOT EXISTS innodb_index_stats (\n"
55 " database_name VARCHAR(64) NOT NULL,\n"
56 " table_name VARCHAR(64) NOT NULL,\n"
57 " index_name VARCHAR(64) NOT NULL,\n"
58 " last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n"
59 " /* there are at least:\n"
60 " stat_name='size'\n"
61 " stat_name='n_leaf_pages'\n"
62 " stat_name='n_diff_pfx%' */\n"
63 " stat_name VARCHAR(64) NOT NULL,\n"
64 " stat_value BIGINT UNSIGNED NOT NULL,\n"
65 " sample_size BIGINT UNSIGNED,\n"
66 " stat_description VARCHAR(1024) NOT NULL,\n"
67 " PRIMARY KEY (database_name, table_name, index_name, stat_name)\n"
68 ") ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0\";\n",
69"SET @create_transaction_registry=\"CREATE TABLE IF NOT EXISTS transaction_registry (\n"
70 " transaction_id BIGINT UNSIGNED NOT NULL,\n"
71 " commit_id BIGINT UNSIGNED NOT NULL,\n"
72 " begin_timestamp TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',\n"
73 " commit_timestamp TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',\n"
74 " isolation_level ENUM('READ-UNCOMMITTED', 'READ-COMMITTED',\n"
75 " 'REPEATABLE-READ', 'SERIALIZABLE') NOT NULL,\n"
76 " PRIMARY KEY (transaction_id),\n"
77 " UNIQUE KEY (commit_id),\n"
78 " INDEX (begin_timestamp),\n"
79 " INDEX (commit_timestamp, transaction_id)\n"
80 ") ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0\";\n",
81"SET @str=IF(@have_innodb <> 0, @create_innodb_table_stats, \"SET @dummy = 0\");\n",
82"PREPARE stmt FROM @str;\n",
83"EXECUTE stmt;\n",
84"DROP PREPARE stmt;\n",
85"SET @str=IF(@have_innodb <> 0, @create_innodb_index_stats, \"SET @dummy = 0\");\n",
86"PREPARE stmt FROM @str;\n",
87"EXECUTE stmt;\n",
88"DROP PREPARE stmt;\n",
89"SET @str=IF(@have_innodb <> 0, @create_transaction_registry, \"SET @dummy = 0\");\n",
90"PREPARE stmt FROM @str;\n",
91"EXECUTE stmt;\n",
92"DROP PREPARE stmt;\n",
93"SET @cmd=\"CREATE TABLE IF NOT EXISTS slave_relay_log_info (\n"
94 " Number_of_lines INTEGER UNSIGNED NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',\n"
95 " Relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',\n"
96 " Relay_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The relay log position of the last executed event.',\n"
97 " Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',\n"
98 " Master_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The master log position of the last executed event.',\n"
99 " Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',\n"
100 " Number_of_workers INTEGER UNSIGNED NOT NULL,\n"
101 " Id INTEGER UNSIGNED NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',\n"
102 " PRIMARY KEY(Id)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Relay Log Information'\";\n",
103"SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_myisam);\n",
104"SET @cmd= \"CREATE TABLE IF NOT EXISTS slave_master_info (\n"
105 " Number_of_lines INTEGER UNSIGNED NOT NULL COMMENT 'Number of lines in the file.',\n"
106 " Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',\n"
107 " Master_log_pos BIGINT UNSIGNED NOT NULL COMMENT 'The master log position of the last read event.',\n"
108 " Host CHAR(64) CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The host name of the master.',\n"
109 " User_name TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',\n"
110 " User_password TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',\n"
111 " Port INTEGER UNSIGNED NOT NULL COMMENT 'The network port used to connect to the master.',\n"
112 " Connect_retry INTEGER UNSIGNED NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',\n"
113 " Enabled_ssl BOOLEAN NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',\n"
114 " Ssl_ca TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',\n"
115 " Ssl_capath TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',\n"
116 " Ssl_cert TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',\n"
117 " Ssl_cipher TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',\n"
118 " Ssl_key TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',\n"
119 " Ssl_verify_server_cert BOOLEAN NOT NULL COMMENT 'Whether to verify the server certificate.',\n"
120 " Heartbeat FLOAT NOT NULL COMMENT '',\n"
121 " Bind TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',\n"
122 " Ignored_server_ids TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',\n"
123 " Uuid TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',\n"
124 " Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',\n"
125 " Ssl_crl TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',\n"
126 " Ssl_crlpath TEXT CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',\n"
127 " Enabled_auto_position BOOLEAN NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',\n"
128 " PRIMARY KEY(Host, Port)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Master Information'\";\n",
129"SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_myisam);\n",
130"SET @cmd= \"CREATE TABLE IF NOT EXISTS slave_worker_info (\n"
131 " Id INTEGER UNSIGNED NOT NULL,\n"
132 " Relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
133 " Relay_log_pos BIGINT UNSIGNED NOT NULL,\n"
134 " Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
135 " Master_log_pos BIGINT UNSIGNED NOT NULL,\n"
136 " Checkpoint_relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
137 " Checkpoint_relay_log_pos BIGINT UNSIGNED NOT NULL,\n"
138 " Checkpoint_master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,\n"
139 " Checkpoint_master_log_pos BIGINT UNSIGNED NOT NULL,\n"
140 " Checkpoint_seqno INT UNSIGNED NOT NULL,\n"
141 " Checkpoint_group_size INTEGER UNSIGNED NOT NULL,\n"
142 " Checkpoint_group_bitmap BLOB NOT NULL,\n"
143 " PRIMARY KEY(Id)) DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT 'Worker Information'\";\n",
144"SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_myisam);\n",
145"CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(80) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';\n",
146"set @had_proxies_priv_table= @@warning_count != 0;\n",
147"CREATE TABLE IF NOT EXISTS table_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';\n",
148"CREATE TABLE IF NOT EXISTS column_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varbinary(255) DEFAULT NULL, max_value varbinary(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, hist_size tinyint unsigned, hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB'), histogram varbinary(255), PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';\n",
149"CREATE TABLE IF NOT EXISTS index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';\n",
150"SET @cmd= \"CREATE TABLE IF NOT EXISTS gtid_slave_pos (\n"
151 " domain_id INT UNSIGNED NOT NULL,\n"
152 " sub_id BIGINT UNSIGNED NOT NULL,\n"
153 " server_id INT UNSIGNED NOT NULL,\n"
154 " seq_no BIGINT UNSIGNED NOT NULL,\n"
155 " PRIMARY KEY (domain_id, sub_id)) CHARSET=latin1\n"
156 "COMMENT='Replication slave GTID position'\";\n",
157"SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_myisam);\n",
158"PREPARE stmt FROM @str;\n",
159"EXECUTE stmt;\n",
160"DROP PREPARE stmt;\n",
161"set storage_engine=@orig_storage_engine;\n",
162"drop table if exists mysql.ndb_binlog_index;\n",
163"set sql_mode='';\n",
164"set storage_engine=MyISAM;\n",
165"set enforce_storage_engine=NULL;\n",
166"ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;\n",
167"SET @hadGrantPriv:=0;\n",
168"SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';\n",
169"ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;\n",
170"ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;\n",
171"ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;\n",
172"UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;\n",
173"UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;\n",
174"UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;\n",
175"ALTER TABLE user\n"
176 "ADD ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci NOT NULL,\n"
177 "ADD ssl_cipher BLOB NOT NULL,\n"
178 "ADD x509_issuer BLOB NOT NULL,\n"
179 "ADD x509_subject BLOB NOT NULL;\n",
180"ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;\n",
181"ALTER TABLE tables_priv\n"
182 " ADD KEY Grantor (Grantor);\n",
183"ALTER TABLE tables_priv\n"
184 " MODIFY Host char(60) NOT NULL default '',\n"
185 " MODIFY Db char(64) NOT NULL default '',\n"
186 " MODIFY User char(80) NOT NULL default '',\n"
187 " MODIFY Table_name char(64) NOT NULL default '',\n"
188 " MODIFY Grantor char(141) NOT NULL default '',\n"
189 " ENGINE=MyISAM,\n"
190 " CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
191"ALTER TABLE tables_priv\n"
192 " MODIFY Column_priv set('Select','Insert','Update','References')\n"
193 " COLLATE utf8_general_ci DEFAULT '' NOT NULL,\n"
194 " MODIFY Table_priv set('Select','Insert','Update','Delete','Create',\n"
195 " 'Drop','Grant','References','Index','Alter',\n"
196 " 'Create View','Show view','Trigger','Delete versioning rows')\n"
197 " COLLATE utf8_general_ci DEFAULT '' NOT NULL,\n"
198 " COMMENT='Table privileges';\n",
199"ALTER TABLE columns_priv\n"
200 " CHANGE Type Column_priv set('Select','Insert','Update','References')\n"
201 " COLLATE utf8_general_ci DEFAULT '' NOT NULL;\n",
202"ALTER TABLE columns_priv\n"
203 " MODIFY Host char(60) NOT NULL default '',\n"
204 " MODIFY Db char(64) NOT NULL default '',\n"
205 " MODIFY User char(80) NOT NULL default '',\n"
206 " MODIFY Table_name char(64) NOT NULL default '',\n"
207 " MODIFY Column_name char(64) NOT NULL default '',\n"
208 " ENGINE=MyISAM,\n"
209 " CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin,\n"
210 " COMMENT='Column privileges';\n",
211"ALTER TABLE columns_priv\n"
212 " MODIFY Column_priv set('Select','Insert','Update','References')\n"
213 " COLLATE utf8_general_ci DEFAULT '' NOT NULL;\n",
214"ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;\n",
215"SET @hadShowDbPriv:=0;\n",
216"SELECT @hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';\n",
217"ALTER TABLE user\n"
218 "ADD Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_priv,\n"
219 "ADD Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_db_priv,\n"
220 "ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Super_priv,\n"
221 "ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,\n"
222 "ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,\n"
223 "ADD Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Execute_priv,\n"
224 "ADD Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;\n",
225"UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv=Process_priv, Create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=File_priv where user<>\"\" AND @hadShowDbPriv = 0;\n",
226"ALTER TABLE user\n"
227 "ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject,\n"
228 "ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions,\n"
229 "ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates;\n",
230"ALTER TABLE db\n"
231 "ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
232 "ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
233"ALTER TABLE host\n"
234 "ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,\n"
235 "ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;\n",
236"alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;\n",
237"alter table db comment='Database privileges';\n",
238"alter table host comment='Host privileges; Merged with database privileges';\n",
239"alter table user comment='Users and global privileges';\n",
240"alter table func comment='User defined functions';\n",
241"ALTER TABLE user\n"
242 " MODIFY Host char(60) NOT NULL default '',\n"
243 " MODIFY User char(80) NOT NULL default '',\n"
244 " ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
245"ALTER TABLE user\n"
246 " ADD Password char(41) character set latin1 collate latin1_bin NOT NULL default '' AFTER User;\n",
247"ALTER TABLE user\n"
248 " MODIFY Password char(41) character set latin1 collate latin1_bin NOT NULL default '',\n"
249 " MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
250 " MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
251 " MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
252 " MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
253 " MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
254 " MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
255 " MODIFY Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
256 " MODIFY Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
257 " MODIFY Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
258 " MODIFY File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
259 " MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
260 " MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
261 " MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
262 " MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
263 " MODIFY Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
264 " MODIFY Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
265 " MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
266 " MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
267 " MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
268 " MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
269 " MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
270 " MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL;\n",
271"ALTER TABLE db\n"
272 " MODIFY Host char(60) NOT NULL default '',\n"
273 " MODIFY Db char(64) NOT NULL default '',\n"
274 " MODIFY User char(80) NOT NULL default '',\n"
275 " ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
276"ALTER TABLE db\n"
277 " MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
278 " MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
279 " MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
280 " MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
281 " MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
282 " MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
283 " MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
284 " MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
285 " MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
286 " MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
287 " MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
288 " MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
289"ALTER TABLE host\n"
290 " MODIFY Host char(60) NOT NULL default '',\n"
291 " MODIFY Db char(64) NOT NULL default '',\n"
292 " ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
293"ALTER TABLE host\n"
294 " MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
295 " MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
296 " MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
297 " MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
298 " MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
299 " MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
300 " MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
301 " MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
302 " MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
303 " MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
304 " MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,\n"
305 " MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
306"ALTER TABLE func\n"
307 " ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
308"ALTER TABLE func\n"
309 " MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;\n",
310"SET @old_log_state = @@global.general_log;\n",
311"SET GLOBAL general_log = 'OFF';\n",
312"ALTER TABLE general_log\n"
313 " MODIFY event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n"
314 " MODIFY user_host MEDIUMTEXT NOT NULL,\n"
315 " MODIFY thread_id INTEGER NOT NULL,\n"
316 " MODIFY server_id INTEGER UNSIGNED NOT NULL,\n"
317 " MODIFY command_type VARCHAR(64) NOT NULL,\n"
318 " MODIFY argument MEDIUMTEXT NOT NULL,\n"
319 " MODIFY thread_id BIGINT(21) UNSIGNED NOT NULL;\n",
320"SET GLOBAL general_log = @old_log_state;\n",
321"SET @old_log_state = @@global.slow_query_log;\n",
322"SET GLOBAL slow_query_log = 'OFF';\n",
323"ALTER TABLE slow_log\n"
324 " ADD COLUMN thread_id BIGINT(21) UNSIGNED NOT NULL AFTER sql_text;\n",
325"ALTER TABLE slow_log\n"
326 " ADD COLUMN rows_affected INTEGER NOT NULL AFTER thread_id;\n",
327"ALTER TABLE slow_log\n"
328 " MODIFY start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n"
329 " MODIFY user_host MEDIUMTEXT NOT NULL,\n"
330 " MODIFY query_time TIME(6) NOT NULL,\n"
331 " MODIFY lock_time TIME(6) NOT NULL,\n"
332 " MODIFY rows_sent INTEGER NOT NULL,\n"
333 " MODIFY rows_examined INTEGER NOT NULL,\n"
334 " MODIFY db VARCHAR(512) NOT NULL,\n"
335 " MODIFY last_insert_id INTEGER NOT NULL,\n"
336 " MODIFY insert_id INTEGER NOT NULL,\n"
337 " MODIFY server_id INTEGER UNSIGNED NOT NULL,\n"
338 " MODIFY sql_text MEDIUMTEXT NOT NULL,\n"
339 " MODIFY thread_id BIGINT(21) UNSIGNED NOT NULL;\n",
340"SET GLOBAL slow_query_log = @old_log_state;\n",
341"ALTER TABLE plugin\n"
342 " MODIFY name varchar(64) COLLATE utf8_general_ci NOT NULL DEFAULT '',\n"
343 " MODIFY dl varchar(128) COLLATE utf8_general_ci NOT NULL DEFAULT '',\n"
344 " CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;\n",
345"SET @hadCreateViewPriv:=0;\n",
346"SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%';\n",
347"ALTER TABLE db ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;\n",
348"ALTER TABLE db MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;\n",
349"ALTER TABLE host ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;\n",
350"ALTER TABLE host MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;\n",
351"ALTER TABLE user ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;\n",
352"ALTER TABLE user MODIFY Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;\n",
353"ALTER TABLE db ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
354"ALTER TABLE db MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
355"ALTER TABLE host ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
356"ALTER TABLE host MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
357"ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
358"ALTER TABLE user MODIFY Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;\n",
359"UPDATE user SET Create_view_priv=Create_priv, Show_view_priv=Create_priv where user<>\"\" AND @hadCreateViewPriv = 0;\n",
360"SET @hadCreateRoutinePriv:=0;\n",
361"SELECT @hadCreateRoutinePriv:=1 FROM user WHERE Create_routine_priv LIKE '%';\n",
362"ALTER TABLE db ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
363"ALTER TABLE db MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
364"ALTER TABLE host ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
365"ALTER TABLE host MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
366"ALTER TABLE user ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
367"ALTER TABLE user MODIFY Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;\n",
368"ALTER TABLE db ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
369"ALTER TABLE db MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
370"ALTER TABLE host ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
371"ALTER TABLE host MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
372"ALTER TABLE user ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
373"ALTER TABLE user MODIFY Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;\n",
374"ALTER TABLE db ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
375"ALTER TABLE db MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
376"ALTER TABLE host ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
377"ALTER TABLE host MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
378"UPDATE user SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv where user<>\"\" AND @hadCreateRoutinePriv = 0;\n",
379"UPDATE db SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Execute_priv=Select_priv where user<>\"\" AND @hadCreateRoutinePriv = 0;\n",
380"UPDATE host SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Execute_priv=Select_priv where @hadCreateRoutinePriv = 0;\n",
381"ALTER TABLE user ADD max_user_connections int(11) DEFAULT '0' NOT NULL AFTER max_connections;\n",
382"ALTER TABLE user MODIFY max_user_connections int(11) DEFAULT '0' NOT NULL AFTER max_connections;\n",
383"SET @hadCreateUserPriv:=0;\n",
384"SELECT @hadCreateUserPriv:=1 FROM user WHERE Create_user_priv LIKE '%';\n",
385"ALTER TABLE user ADD Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
386"ALTER TABLE user MODIFY Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;\n",
387"UPDATE user LEFT JOIN db USING (Host,User) SET Create_user_priv='Y'\n"
388 " WHERE @hadCreateUserPriv = 0 AND\n"
389 " (user.Grant_priv = 'Y' OR db.Grant_priv = 'Y');\n",
390"ALTER TABLE procs_priv\n"
391 " ENGINE=MyISAM,\n"
392 " CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;\n",
393"ALTER TABLE procs_priv\n"
394 " MODIFY Proc_priv set('Execute','Alter Routine','Grant')\n"
395 " COLLATE utf8_general_ci DEFAULT '' NOT NULL;\n",
396"ALTER IGNORE TABLE procs_priv\n"
397 " MODIFY Routine_name char(64)\n"
398 " COLLATE utf8_general_ci DEFAULT '' NOT NULL;\n",
399"ALTER TABLE procs_priv\n"
400 " ADD Routine_type enum('FUNCTION','PROCEDURE')\n"
401 " COLLATE utf8_general_ci NOT NULL AFTER Routine_name;\n",
402"ALTER TABLE procs_priv\n"
403 " MODIFY Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER Proc_priv;\n",
404"ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,\n"
405 " MODIFY specific_name char(64) DEFAULT '' NOT NULL,\n"
406 " MODIFY sql_data_access\n"
407 " enum('CONTAINS_SQL',\n"
408 " 'NO_SQL',\n"
409 " 'READS_SQL_DATA',\n"
410 " 'MODIFIES_SQL_DATA'\n"
411 " ) DEFAULT 'CONTAINS_SQL' NOT NULL,\n"
412 " MODIFY body longblob NOT NULL,\n"
413 " MODIFY returns longblob NOT NULL,\n"
414 " MODIFY sql_mode\n"
415 " set('REAL_AS_FLOAT',\n"
416 " 'PIPES_AS_CONCAT',\n"
417 " 'ANSI_QUOTES',\n"
418 " 'IGNORE_SPACE',\n"
419 " 'IGNORE_BAD_TABLE_OPTIONS',\n"
420 " 'ONLY_FULL_GROUP_BY',\n"
421 " 'NO_UNSIGNED_SUBTRACTION',\n"
422 " 'NO_DIR_IN_CREATE',\n"
423 " 'POSTGRESQL',\n"
424 " 'ORACLE',\n"
425 " 'MSSQL',\n"
426 " 'DB2',\n"
427 " 'MAXDB',\n"
428 " 'NO_KEY_OPTIONS',\n"
429 " 'NO_TABLE_OPTIONS',\n"
430 " 'NO_FIELD_OPTIONS',\n"
431 " 'MYSQL323',\n"
432 " 'MYSQL40',\n"
433 " 'ANSI',\n"
434 " 'NO_AUTO_VALUE_ON_ZERO',\n"
435 " 'NO_BACKSLASH_ESCAPES',\n"
436 " 'STRICT_TRANS_TABLES',\n"
437 " 'STRICT_ALL_TABLES',\n"
438 " 'NO_ZERO_IN_DATE',\n"
439 " 'NO_ZERO_DATE',\n"
440 " 'INVALID_DATES',\n"
441 " 'ERROR_FOR_DIVISION_BY_ZERO',\n"
442 " 'TRADITIONAL',\n"
443 " 'NO_AUTO_CREATE_USER',\n"
444 " 'HIGH_NOT_PRECEDENCE',\n"
445 " 'NO_ENGINE_SUBSTITUTION',\n"
446 " 'PAD_CHAR_TO_FULL_LENGTH',\n"
447 " 'EMPTY_STRING_IS_NULL',\n"
448 " 'SIMULTANEOUS_ASSIGNMENT'\n"
449 " ) DEFAULT '' NOT NULL,\n"
450 " DEFAULT CHARACTER SET utf8;\n",
451"ALTER TABLE proc CONVERT TO CHARACTER SET utf8;\n",
452"ALTER TABLE proc MODIFY db\n"
453 " char(64) collate utf8_bin DEFAULT '' NOT NULL,\n"
454 " MODIFY definer\n"
455 " char(141) collate utf8_bin DEFAULT '' NOT NULL,\n"
456 " MODIFY comment\n"
457 " char(64) collate utf8_bin DEFAULT '' NOT NULL;\n",
458"ALTER TABLE proc ADD character_set_client\n"
459 " char(32) collate utf8_bin DEFAULT NULL\n"
460 " AFTER comment;\n",
461"ALTER TABLE proc MODIFY character_set_client\n"
462 " char(32) collate utf8_bin DEFAULT NULL;\n",
463"ALTER TABLE proc MODIFY type enum('FUNCTION',\n"
464 " 'PROCEDURE',\n"
465 " 'PACKAGE',\n"
466 " 'PACKAGE BODY') NOT NULL;\n",
467"ALTER TABLE procs_priv MODIFY Routine_type enum('FUNCTION',\n"
468 " 'PROCEDURE',\n"
469 " 'PACKAGE',\n"
470 " 'PACKAGE BODY') NOT NULL;\n",
471"SELECT CASE WHEN COUNT(*) > 0 THEN\n"
472 "CONCAT (\"WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (\", @@character_set_client, \"). Please verify if necessary.\")\n"
473 "ELSE NULL\n"
474 "END\n"
475 "AS value FROM proc WHERE character_set_client IS NULL;\n",
476"UPDATE proc SET character_set_client = @@character_set_client\n"
477 " WHERE character_set_client IS NULL;\n",
478"ALTER TABLE proc ADD collation_connection\n"
479 " char(32) collate utf8_bin DEFAULT NULL\n"
480 " AFTER character_set_client;\n",
481"ALTER TABLE proc MODIFY collation_connection\n"
482 " char(32) collate utf8_bin DEFAULT NULL;\n",
483"SELECT CASE WHEN COUNT(*) > 0 THEN\n"
484 "CONCAT (\"WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (\", @@collation_connection, \"). Please verify if necessary.\")\n"
485 "ELSE NULL\n"
486 "END\n"
487 "AS value FROM proc WHERE collation_connection IS NULL;\n",
488"UPDATE proc SET collation_connection = @@collation_connection\n"
489 " WHERE collation_connection IS NULL;\n",
490"ALTER TABLE proc ADD db_collation\n"
491 " char(32) collate utf8_bin DEFAULT NULL\n"
492 " AFTER collation_connection;\n",
493"ALTER TABLE proc MODIFY db_collation\n"
494 " char(32) collate utf8_bin DEFAULT NULL;\n",
495"SELECT CASE WHEN COUNT(*) > 0 THEN\n"
496 "CONCAT (\"WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.\")\n"
497 "ELSE NULL\n"
498 "END\n"
499 "AS value FROM proc WHERE db_collation IS NULL;\n",
500"UPDATE proc AS p SET db_collation =\n"
501 " ( SELECT DEFAULT_COLLATION_NAME\n"
502 " FROM INFORMATION_SCHEMA.SCHEMATA\n"
503 " WHERE SCHEMA_NAME = p.db)\n"
504 " WHERE db_collation IS NULL;\n",
505"ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL\n"
506 " AFTER db_collation;\n",
507"ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL;\n",
508"ALTER TABLE proc MODIFY comment\n"
509 " text collate utf8_bin NOT NULL;\n",
510"ALTER TABLE proc ADD aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL\n"
511 " AFTER body_utf8;\n",
512"SET @hadEventPriv := 0;\n",
513"SELECT @hadEventPriv :=1 FROM user WHERE Event_priv LIKE '%';\n",
514"ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv;\n",
515"ALTER TABLE user MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv;\n",
516"UPDATE user SET Event_priv=Super_priv WHERE @hadEventPriv = 0;\n",
517"ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL;\n",
518"ALTER TABLE db MODIFY Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL;\n",
519"ALTER TABLE event DROP PRIMARY KEY;\n",
520"ALTER TABLE event ADD PRIMARY KEY(db, name);\n",
521"ALTER TABLE event ADD sql_mode set ('IGNORE_BAD_TABLE_OPTIONS') AFTER on_completion;\n",
522"ALTER TABLE event MODIFY sql_mode\n"
523 " set('REAL_AS_FLOAT',\n"
524 " 'PIPES_AS_CONCAT',\n"
525 " 'ANSI_QUOTES',\n"
526 " 'IGNORE_SPACE',\n"
527 " 'IGNORE_BAD_TABLE_OPTIONS',\n"
528 " 'ONLY_FULL_GROUP_BY',\n"
529 " 'NO_UNSIGNED_SUBTRACTION',\n"
530 " 'NO_DIR_IN_CREATE',\n"
531 " 'POSTGRESQL',\n"
532 " 'ORACLE',\n"
533 " 'MSSQL',\n"
534 " 'DB2',\n"
535 " 'MAXDB',\n"
536 " 'NO_KEY_OPTIONS',\n"
537 " 'NO_TABLE_OPTIONS',\n"
538 " 'NO_FIELD_OPTIONS',\n"
539 " 'MYSQL323',\n"
540 " 'MYSQL40',\n"
541 " 'ANSI',\n"
542 " 'NO_AUTO_VALUE_ON_ZERO',\n"
543 " 'NO_BACKSLASH_ESCAPES',\n"
544 " 'STRICT_TRANS_TABLES',\n"
545 " 'STRICT_ALL_TABLES',\n"
546 " 'NO_ZERO_IN_DATE',\n"
547 " 'NO_ZERO_DATE',\n"
548 " 'INVALID_DATES',\n"
549 " 'ERROR_FOR_DIVISION_BY_ZERO',\n"
550 " 'TRADITIONAL',\n"
551 " 'NO_AUTO_CREATE_USER',\n"
552 " 'HIGH_NOT_PRECEDENCE',\n"
553 " 'NO_ENGINE_SUBSTITUTION',\n"
554 " 'PAD_CHAR_TO_FULL_LENGTH',\n"
555 " 'EMPTY_STRING_IS_NULL',\n"
556 " 'SIMULTANEOUS_ASSIGNMENT'\n"
557 " ) DEFAULT '' NOT NULL AFTER on_completion;\n",
558"ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';\n",
559"ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL;\n",
560"ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment;\n",
561"ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED';\n",
562"ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1\n"
563 " NOT NULL DEFAULT 'SYSTEM' AFTER originator;\n",
564"ALTER TABLE event ADD character_set_client\n"
565 " char(32) collate utf8_bin DEFAULT NULL\n"
566 " AFTER time_zone;\n",
567"ALTER TABLE event MODIFY character_set_client\n"
568 " char(32) collate utf8_bin DEFAULT NULL;\n",
569"ALTER TABLE event ADD collation_connection\n"
570 " char(32) collate utf8_bin DEFAULT NULL\n"
571 " AFTER character_set_client;\n",
572"ALTER TABLE event MODIFY collation_connection\n"
573 " char(32) collate utf8_bin DEFAULT NULL;\n",
574"ALTER TABLE event ADD db_collation\n"
575 " char(32) collate utf8_bin DEFAULT NULL\n"
576 " AFTER collation_connection;\n",
577"ALTER TABLE event MODIFY db_collation\n"
578 " char(32) collate utf8_bin DEFAULT NULL;\n",
579"ALTER TABLE event ADD body_utf8 longblob DEFAULT NULL\n"
580 " AFTER db_collation;\n",
581"ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL;\n",
582"set global event_scheduler=original;\n",
583"SET @hadTriggerPriv := 0;\n",
584"SELECT @hadTriggerPriv :=1 FROM user WHERE Trigger_priv LIKE '%';\n",
585"ALTER TABLE user ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Event_priv;\n",
586"ALTER TABLE user MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Event_priv;\n",
587"ALTER TABLE host ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
588"ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
589"ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
590"ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
591"UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;\n",
592"SET @hadCreateTablespacePriv := 0;\n",
593"SELECT @hadCreateTablespacePriv :=1 FROM user WHERE Create_tablespace_priv LIKE '%';\n",
594"ALTER TABLE user ADD Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv;\n",
595"ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv;\n",
596"UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;\n",
597"ALTER TABLE user change Truncate_versioning_priv Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';\n",
598"ALTER TABLE db change Truncate_versioning_priv Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';\n",
599"SET @had_user_delete_history_priv := 0;\n",
600"SELECT @had_user_delete_history_priv :=1 FROM user WHERE Delete_history_priv LIKE '%';\n",
601"ALTER TABLE user add Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Create_tablespace_priv;\n",
602"ALTER TABLE user modify Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';\n",
603"ALTER TABLE db add Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N' after Trigger_priv;\n",
604"ALTER TABLE db modify Delete_history_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL DEFAULT 'N';\n",
605"UPDATE user SET Delete_history_priv = Super_priv WHERE @had_user_delete_history_priv = 0;\n",
606"ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;\n",
607"ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
608"ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
609"ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL;\n",
610"ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;\n",
611"ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, MODIFY authentication_string TEXT NOT NULL;\n",
612"ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
613"ALTER TABLE user MODIFY is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;\n",
614"CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;\n",
615"INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());\n",
616"INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;\n",
617"DROP TABLE tmp_proxies_priv;\n",
618"DROP PROCEDURE IF EXISTS mysql.count_duplicate_host_names;\n",
619"DELIMITER //\n"
620 "CREATE PROCEDURE mysql.count_duplicate_host_names()\n"
621 "BEGIN\n"
622 " SET @duplicate_hosts=(SELECT count(*) FROM mysql.user GROUP BY user, lower(host) HAVING count(*) > 1 LIMIT 1);\n",
623" IF @duplicate_hosts > 1 THEN\n"
624 " SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them';\n",
625" END IF;\n",
626"END //\n"
627 "DELIMITER ;\n",
628"CALL mysql.count_duplicate_host_names();\n",
629"SHOW WARNINGS;\n",
630"DROP PROCEDURE mysql.count_duplicate_host_names;\n",
631"UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;\n",
632"set @str=\"delete from innodb_index_stats where length(table_name) > 64\";\n",
633"set @str=if(@have_innodb <> 0, @str, \"set @dummy = 0\");\n",
634"prepare stmt from @str;\n",
635"execute stmt;\n",
636"set @str=replace(@str, \"innodb_index_stats\", \"innodb_table_stats\");\n",
637"prepare stmt from @str;\n",
638"execute stmt;\n",
639"set @str=\"alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp\";\n",
640"set @str=if(@have_innodb <> 0, @str, \"set @dummy = 0\");\n",
641"prepare stmt from @str;\n",
642"execute stmt;\n",
643"set @str=\"alter table mysql.innodb_table_stats modify last_update timestamp not null default current_timestamp on update current_timestamp\";\n",
644"set @str=if(@have_innodb <> 0, @str, \"set @dummy = 0\");\n",
645"prepare stmt from @str;\n",
646"execute stmt;\n",
647"set @str=replace(@str, \"innodb_index_stats\", \"innodb_table_stats\");\n",
648"prepare stmt from @str;\n",
649"execute stmt;\n",
650"SET @innodb_index_stats_fk= (select count(*) from information_schema.referential_constraints where constraint_schema='mysql' and table_name = 'innodb_index_stats' and referenced_table_name = 'innodb_table_stats' and constraint_name = 'innodb_index_stats_ibfk_1');\n",
651"SET @str=IF(@innodb_index_stats_fk > 0 and @have_innodb > 0, \"ALTER TABLE mysql.innodb_index_stats DROP FOREIGN KEY `innodb_index_stats_ibfk_1`\", \"SET @dummy = 0\");\n",
652"PREPARE stmt FROM @str;\n",
653"EXECUTE stmt;\n",
654"DROP PREPARE stmt;\n",
655"alter table user modify User char(80) binary not null default '';\n",
656"alter table db modify User char(80) binary not null default '';\n",
657"alter table tables_priv modify User char(80) binary not null default '';\n",
658"alter table columns_priv modify User char(80) binary not null default '';\n",
659"alter table procs_priv modify User char(80) binary not null default '';\n",
660"alter table proc modify definer char(141) collate utf8_bin not null default '';\n",
661"alter table event modify definer char(141) collate utf8_bin not null default '';\n",
662"alter table proxies_priv modify User char(80) COLLATE utf8_bin not null default '';\n",
663"alter table proxies_priv modify Proxied_user char(80) COLLATE utf8_bin not null default '';\n",
664"alter table proxies_priv modify Grantor char(141) COLLATE utf8_bin not null default '';\n",
665"alter table servers modify Username char(80) not null default '';\n",
666"alter table procs_priv modify Grantor char(141) COLLATE utf8_bin not null default '';\n",
667"alter table tables_priv modify Grantor char(141) COLLATE utf8_bin not null default '';\n",
668"flush privileges;\n",
669"ALTER TABLE help_category MODIFY url TEXT NOT NULL;\n",
670"ALTER TABLE help_topic MODIFY url TEXT NOT NULL;\n",
671"alter table column_stats modify min_value varbinary(255) DEFAULT NULL, modify max_value varbinary(255) DEFAULT NULL;\n",
672"set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');\n",
673"SET @cmd=\"SET @broken_tables = (select count(*) from information_schema.tables where engine != 'PERFORMANCE_SCHEMA' and table_schema='performance_schema')\";\n",
674"SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');\n",
675"PREPARE stmt FROM @str;\n",
676"EXECUTE stmt;\n",
677"DROP PREPARE stmt;\n",
678"SET @cmd=\"SET @broken_views = (select count(*) from information_schema.views where table_schema='performance_schema')\";\n",
679"SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');\n",
680"PREPARE stmt FROM @str;\n",
681"EXECUTE stmt;\n",
682"DROP PREPARE stmt;\n",
683"SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');\n",
684"SET @broken_events = (select count(*) from mysql.event where db='performance_schema');\n",
685"SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);\n",
686"SET @cmd= \"DROP DATABASE IF EXISTS performance_schema\";\n",
687"SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');\n",
688"PREPARE stmt FROM @str;\n",
689"EXECUTE stmt;\n",
690"DROP PREPARE stmt;\n",
691"SET @cmd= \"CREATE DATABASE performance_schema character set utf8\";\n",
692"SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');\n",
693"PREPARE stmt FROM @str;\n",
694"EXECUTE stmt;\n",
695"DROP PREPARE stmt;\n",
696NULL
697};
698