diff options
31 files changed, 354 insertions, 1793 deletions
diff --git a/.bzrignore b/.bzrignore index ac692af1db1..0e0546e68c3 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1335,3 +1335,4 @@ win/vs71cache.txt win/vs8cache.txt zlib/*.ds? zlib/*.vcproj +scripts/mysql_fix_privilege_tables.sql diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index ed85f06fcc5..d48b8c7dfe4 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -66,7 +66,6 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data - $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib install-data-local: @@ -98,7 +97,6 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib uninstall-local: diff --git a/mysql-test/include/add_anonymous_users.inc b/mysql-test/include/add_anonymous_users.inc new file mode 100644 index 00000000000..a59aa971d59 --- /dev/null +++ b/mysql-test/include/add_anonymous_users.inc @@ -0,0 +1,7 @@ +# Allow anonymous users to connect +disable_warnings; +disable_query_log; +INSERT INTO mysql.user (host, user) VALUES ('localhost',''); +FLUSH PRIVILEGES; +enable_query_log; +enable_warnings; diff --git a/mysql-test/include/delete_anonymous_users.inc b/mysql-test/include/delete_anonymous_users.inc new file mode 100644 index 00000000000..9f642223748 --- /dev/null +++ b/mysql-test/include/delete_anonymous_users.inc @@ -0,0 +1,5 @@ +# Remove anonymous users added by add_anonymous_users.inc +disable_query_log; +DELETE FROM mysql.user where host='localhost' and user=''; +FLUSH PRIVILEGES; +enable_query_log; diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql deleted file mode 100644 index 63483af00d6..00000000000 --- a/mysql-test/init_db.sql +++ /dev/null @@ -1,58 +0,0 @@ -CREATE DATABASE mysql; -CREATE DATABASE test; - -USE mysql; - - -CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; - -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); - - -CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; - -CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') 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,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; - -INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0); - -CREATE TABLE 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') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; - -CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; - -CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; - -CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics'; - -CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories'; - -CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; - -CREATE TABLE 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'; - -CREATE TABLE 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'; - -INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); - - -CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; - -INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); - - -CREATE TABLE 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'; - -INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8); - - -CREATE TABLE 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'; - -INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); - -CREATE TABLE 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'; - -INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22); - - diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql deleted file mode 100644 index fd7b035e038..00000000000 --- a/mysql-test/lib/init_db.sql +++ /dev/null @@ -1,559 +0,0 @@ -use mysql; -set table_type=myisam; - -CREATE TABLE db ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) 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, - PRIMARY KEY Host (Host,Db,User), - KEY User (User) -) engine=MyISAM -CHARACTER SET utf8 COLLATE utf8_bin -comment='Database privileges'; - - -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); - - -CREATE TABLE 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, - PRIMARY KEY Host (Host,Db) -) engine=MyISAM -CHARACTER SET utf8 COLLATE utf8_bin -comment='Host privileges; Merged with database privileges'; - - -CREATE TABLE user ( - Host char(60) binary DEFAULT '' NOT NULL, - User char(16) 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, - 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) unsigned DEFAULT 0 NOT NULL, - PRIMARY KEY Host (Host,User) -) engine=MyISAM -CHARACTER SET utf8 COLLATE utf8_bin -comment='Users and global privileges'; - - -INSERT INTO user VALUES ('localhost' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -INSERT INTO user VALUES ('@HOSTNAME@%' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO user VALUES ('127.0.0.1' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -INSERT INTO user (host,user) VALUES ('localhost',''); -INSERT INTO user (host,user) VALUES ('@HOSTNAME@%',''); - - -CREATE TABLE 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'; - - -CREATE TABLE tables_priv ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) binary DEFAULT '' NOT NULL, - Table_name char(64) binary DEFAULT '' NOT NULL, - Grantor char(77) DEFAULT '' NOT NULL, - Timestamp timestamp(14), - Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') 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'; - - -CREATE TABLE columns_priv ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) binary DEFAULT '' NOT NULL, - Table_name char(64) binary DEFAULT '' NOT NULL, - Column_name char(64) binary DEFAULT '' NOT NULL, - Timestamp timestamp(14), - 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'; - - -CREATE TABLE 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 char(128) not null, - primary key (help_topic_id), - unique index (name) -) engine=MyISAM -CHARACTER SET utf8 -comment='help topics'; - - -CREATE TABLE help_category ( - help_category_id smallint unsigned not null, - name char(64) not null, - parent_category_id smallint unsigned null, - url char(128) not null, - primary key (help_category_id),unique index (name) -) engine=MyISAM -CHARACTER SET utf8 -comment='help categories'; - - -CREATE TABLE 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'; - - -CREATE TABLE 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'; - - -CREATE TABLE 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'; - - -INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES - ('MET', 1), ('UTC', 2), ('Universal', 2), - ('Europe/Moscow',3), ('leap/Europe/Moscow',4), - ('Japan', 5); - - -CREATE TABLE 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'; - - -INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) - VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); - - -CREATE TABLE 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'; - - -INSERT INTO time_zone_transition - (Time_zone_id, Transition_time, Transition_type_id) -VALUES - (1, -1693706400, 0) ,(1, -1680483600, 1) - ,(1, -1663455600, 2) ,(1, -1650150000, 3) - ,(1, -1632006000, 2) ,(1, -1618700400, 3) - ,(1, -938905200, 2) ,(1, -857257200, 3) - ,(1, -844556400, 2) ,(1, -828226800, 3) - ,(1, -812502000, 2) ,(1, -796777200, 3) - ,(1, 228877200, 2) ,(1, 243997200, 3) - ,(1, 260326800, 2) ,(1, 276051600, 3) - ,(1, 291776400, 2) ,(1, 307501200, 3) - ,(1, 323830800, 2) ,(1, 338950800, 3) - ,(1, 354675600, 2) ,(1, 370400400, 3) - ,(1, 386125200, 2) ,(1, 401850000, 3) - ,(1, 417574800, 2) ,(1, 433299600, 3) - ,(1, 449024400, 2) ,(1, 465354000, 3) - ,(1, 481078800, 2) ,(1, 496803600, 3) - ,(1, 512528400, 2) ,(1, 528253200, 3) - ,(1, 543978000, 2) ,(1, 559702800, 3) - ,(1, 575427600, 2) ,(1, 591152400, 3) - ,(1, 606877200, 2) ,(1, 622602000, 3) - ,(1, 638326800, 2) ,(1, 654656400, 3) - ,(1, 670381200, 2) ,(1, 686106000, 3) - ,(1, 701830800, 2) ,(1, 717555600, 3) - ,(1, 733280400, 2) ,(1, 749005200, 3) - ,(1, 764730000, 2) ,(1, 780454800, 3) - ,(1, 796179600, 2) ,(1, 811904400, 3) - ,(1, 828234000, 2) ,(1, 846378000, 3) - ,(1, 859683600, 2) ,(1, 877827600, 3) - ,(1, 891133200, 2) ,(1, 909277200, 3) - ,(1, 922582800, 2) ,(1, 941331600, 3) - ,(1, 954032400, 2) ,(1, 972781200, 3) - ,(1, 985482000, 2) ,(1, 1004230800, 3) - ,(1, 1017536400, 2) ,(1, 1035680400, 3) - ,(1, 1048986000, 2) ,(1, 1067130000, 3) - ,(1, 1080435600, 2) ,(1, 1099184400, 3) - ,(1, 1111885200, 2) ,(1, 1130634000, 3) - ,(1, 1143334800, 2) ,(1, 1162083600, 3) - ,(1, 1174784400, 2) ,(1, 1193533200, 3) - ,(1, 1206838800, 2) ,(1, 1224982800, 3) - ,(1, 1238288400, 2) ,(1, 1256432400, 3) - ,(1, 1269738000, 2) ,(1, 1288486800, 3) - ,(1, 1301187600, 2) ,(1, 1319936400, 3) - ,(1, 1332637200, 2) ,(1, 1351386000, 3) - ,(1, 1364691600, 2) ,(1, 1382835600, 3) - ,(1, 1396141200, 2) ,(1, 1414285200, 3) - ,(1, 1427590800, 2) ,(1, 1445734800, 3) - ,(1, 1459040400, 2) ,(1, 1477789200, 3) - ,(1, 1490490000, 2) ,(1, 1509238800, 3) - ,(1, 1521939600, 2) ,(1, 1540688400, 3) - ,(1, 1553994000, 2) ,(1, 1572138000, 3) - ,(1, 1585443600, 2) ,(1, 1603587600, 3) - ,(1, 1616893200, 2) ,(1, 1635642000, 3) - ,(1, 1648342800, 2) ,(1, 1667091600, 3) - ,(1, 1679792400, 2) ,(1, 1698541200, 3) - ,(1, 1711846800, 2) ,(1, 1729990800, 3) - ,(1, 1743296400, 2) ,(1, 1761440400, 3) - ,(1, 1774746000, 2) ,(1, 1792890000, 3) - ,(1, 1806195600, 2) ,(1, 1824944400, 3) - ,(1, 1837645200, 2) ,(1, 1856394000, 3) - ,(1, 1869094800, 2) ,(1, 1887843600, 3) - ,(1, 1901149200, 2) ,(1, 1919293200, 3) - ,(1, 1932598800, 2) ,(1, 1950742800, 3) - ,(1, 1964048400, 2) ,(1, 1982797200, 3) - ,(1, 1995498000, 2) ,(1, 2014246800, 3) - ,(1, 2026947600, 2) ,(1, 2045696400, 3) - ,(1, 2058397200, 2) ,(1, 2077146000, 3) - ,(1, 2090451600, 2) ,(1, 2108595600, 3) - ,(1, 2121901200, 2) ,(1, 2140045200, 3) - ,(3, -1688265000, 2) ,(3, -1656819048, 1) - ,(3, -1641353448, 2) ,(3, -1627965048, 3) - ,(3, -1618716648, 1) ,(3, -1596429048, 3) - ,(3, -1593829848, 5) ,(3, -1589860800, 4) - ,(3, -1542427200, 5) ,(3, -1539493200, 6) - ,(3, -1525323600, 5) ,(3, -1522728000, 4) - ,(3, -1491188400, 7) ,(3, -1247536800, 4) - ,(3, 354920400, 5) ,(3, 370728000, 4) - ,(3, 386456400, 5) ,(3, 402264000, 4) - ,(3, 417992400, 5) ,(3, 433800000, 4) - ,(3, 449614800, 5) ,(3, 465346800, 8) - ,(3, 481071600, 9) ,(3, 496796400, 8) - ,(3, 512521200, 9) ,(3, 528246000, 8) - ,(3, 543970800, 9) ,(3, 559695600, 8) - ,(3, 575420400, 9) ,(3, 591145200, 8) - ,(3, 606870000, 9) ,(3, 622594800, 8) - ,(3, 638319600, 9) ,(3, 654649200, 8) - ,(3, 670374000, 10) ,(3, 686102400, 11) - ,(3, 695779200, 8) ,(3, 701812800, 5) - ,(3, 717534000, 4) ,(3, 733273200, 9) - ,(3, 748998000, 8) ,(3, 764722800, 9) - ,(3, 780447600, 8) ,(3, 796172400, 9) - ,(3, 811897200, 8) ,(3, 828226800, 9) - ,(3, 846370800, 8) ,(3, 859676400, 9) - ,(3, 877820400, 8) ,(3, 891126000, 9) - ,(3, 909270000, 8) ,(3, 922575600, 9) - ,(3, 941324400, 8) ,(3, 954025200, 9) - ,(3, 972774000, 8) ,(3, 985474800, 9) - ,(3, 1004223600, 8) ,(3, 1017529200, 9) - ,(3, 1035673200, 8) ,(3, 1048978800, 9) - ,(3, 1067122800, 8) ,(3, 1080428400, 9) - ,(3, 1099177200, 8) ,(3, 1111878000, 9) - ,(3, 1130626800, 8) ,(3, 1143327600, 9) - ,(3, 1162076400, 8) ,(3, 1174777200, 9) - ,(3, 1193526000, 8) ,(3, 1206831600, 9) - ,(3, 1224975600, 8) ,(3, 1238281200, 9) - ,(3, 1256425200, 8) ,(3, 1269730800, 9) - ,(3, 1288479600, 8) ,(3, 1301180400, 9) - ,(3, 1319929200, 8) ,(3, 1332630000, 9) - ,(3, 1351378800, 8) ,(3, 1364684400, 9) - ,(3, 1382828400, 8) ,(3, 1396134000, 9) - ,(3, 1414278000, 8) ,(3, 1427583600, 9) - ,(3, 1445727600, 8) ,(3, 1459033200, 9) - ,(3, 1477782000, 8) ,(3, 1490482800, 9) - ,(3, 1509231600, 8) ,(3, 1521932400, 9) - ,(3, 1540681200, 8) ,(3, 1553986800, 9) - ,(3, 1572130800, 8) ,(3, 1585436400, 9) - ,(3, 1603580400, 8) ,(3, 1616886000, 9) - ,(3, 1635634800, 8) ,(3, 1648335600, 9) - ,(3, 1667084400, 8) ,(3, 1679785200, 9) - ,(3, 1698534000, 8) ,(3, 1711839600, 9) - ,(3, 1729983600, 8) ,(3, 1743289200, 9) - ,(3, 1761433200, 8) ,(3, 1774738800, 9) - ,(3, 1792882800, 8) ,(3, 1806188400, 9) - ,(3, 1824937200, 8) ,(3, 1837638000, 9) - ,(3, 1856386800, 8) ,(3, 1869087600, 9) - ,(3, 1887836400, 8) ,(3, 1901142000, 9) - ,(3, 1919286000, 8) ,(3, 1932591600, 9) - ,(3, 1950735600, 8) ,(3, 1964041200, 9) - ,(3, 1982790000, 8) ,(3, 1995490800, 9) - ,(3, 2014239600, 8) ,(3, 2026940400, 9) - ,(3, 2045689200, 8) ,(3, 2058390000, 9) - ,(3, 2077138800, 8) ,(3, 2090444400, 9) - ,(3, 2108588400, 8) ,(3, 2121894000, 9) - ,(3, 2140038000, 8) - ,(4, -1688265000, 2) ,(4, -1656819048, 1) - ,(4, -1641353448, 2) ,(4, -1627965048, 3) - ,(4, -1618716648, 1) ,(4, -1596429048, 3) - ,(4, -1593829848, 5) ,(4, -1589860800, 4) - ,(4, -1542427200, 5) ,(4, -1539493200, 6) - ,(4, -1525323600, 5) ,(4, -1522728000, 4) - ,(4, -1491188400, 7) ,(4, -1247536800, 4) - ,(4, 354920409, 5) ,(4, 370728010, 4) - ,(4, 386456410, 5) ,(4, 402264011, 4) - ,(4, 417992411, 5) ,(4, 433800012, 4) - ,(4, 449614812, 5) ,(4, 465346812, 8) - ,(4, 481071612, 9) ,(4, 496796413, 8) - ,(4, 512521213, 9) ,(4, 528246013, 8) - ,(4, 543970813, 9) ,(4, 559695613, 8) - ,(4, 575420414, 9) ,(4, 591145214, 8) - ,(4, 606870014, 9) ,(4, 622594814, 8) - ,(4, 638319615, 9) ,(4, 654649215, 8) - ,(4, 670374016, 10) ,(4, 686102416, 11) - ,(4, 695779216, 8) ,(4, 701812816, 5) - ,(4, 717534017, 4) ,(4, 733273217, 9) - ,(4, 748998018, 8) ,(4, 764722818, 9) - ,(4, 780447619, 8) ,(4, 796172419, 9) - ,(4, 811897219, 8) ,(4, 828226820, 9) - ,(4, 846370820, 8) ,(4, 859676420, 9) - ,(4, 877820421, 8) ,(4, 891126021, 9) - ,(4, 909270021, 8) ,(4, 922575622, 9) - ,(4, 941324422, 8) ,(4, 954025222, 9) - ,(4, 972774022, 8) ,(4, 985474822, 9) - ,(4, 1004223622, 8) ,(4, 1017529222, 9) - ,(4, 1035673222, 8) ,(4, 1048978822, 9) - ,(4, 1067122822, 8) ,(4, 1080428422, 9) - ,(4, 1099177222, 8) ,(4, 1111878022, 9) - ,(4, 1130626822, 8) ,(4, 1143327622, 9) - ,(4, 1162076422, 8) ,(4, 1174777222, 9) - ,(4, 1193526022, 8) ,(4, 1206831622, 9) - ,(4, 1224975622, 8) ,(4, 1238281222, 9) - ,(4, 1256425222, 8) ,(4, 1269730822, 9) - ,(4, 1288479622, 8) ,(4, 1301180422, 9) - ,(4, 1319929222, 8) ,(4, 1332630022, 9) - ,(4, 1351378822, 8) ,(4, 1364684422, 9) - ,(4, 1382828422, 8) ,(4, 1396134022, 9) - ,(4, 1414278022, 8) ,(4, 1427583622, 9) - ,(4, 1445727622, 8) ,(4, 1459033222, 9) - ,(4, 1477782022, 8) ,(4, 1490482822, 9) - ,(4, 1509231622, 8) ,(4, 1521932422, 9) - ,(4, 1540681222, 8) ,(4, 1553986822, 9) - ,(4, 1572130822, 8) ,(4, 1585436422, 9) - ,(4, 1603580422, 8) ,(4, 1616886022, 9) - ,(4, 1635634822, 8) ,(4, 1648335622, 9) - ,(4, 1667084422, 8) ,(4, 1679785222, 9) - ,(4, 1698534022, 8) ,(4, 1711839622, 9) - ,(4, 1729983622, 8) ,(4, 1743289222, 9) - ,(4, 1761433222, 8) ,(4, 1774738822, 9) - ,(4, 1792882822, 8) ,(4, 1806188422, 9) - ,(4, 1824937222, 8) ,(4, 1837638022, 9) - ,(4, 1856386822, 8) ,(4, 1869087622, 9) - ,(4, 1887836422, 8) ,(4, 1901142022, 9) - ,(4, 1919286022, 8) ,(4, 1932591622, 9) - ,(4, 1950735622, 8) ,(4, 1964041222, 9) - ,(4, 1982790022, 8) ,(4, 1995490822, 9) - ,(4, 2014239622, 8) ,(4, 2026940422, 9) - ,(4, 2045689222, 8) ,(4, 2058390022, 9) - ,(4, 2077138822, 8) ,(4, 2090444422, 9) - ,(4, 2108588422, 8) ,(4, 2121894022, 9) - ,(4, 2140038022, 8) - ,(5, -1009875600, 1); - - -CREATE TABLE 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'; - - -INSERT INTO time_zone_transition_type ( - Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES - (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') - ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') - ,(2, 0, 0, 0, 'UTC') - ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') - ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') - ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') - ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') - ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') - ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') - ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') - ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') - ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') - ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') - ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') - ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') - ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); - - -CREATE TABLE 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'; - - -INSERT INTO time_zone_leap_second ( - Transition_time, Correction) VALUES - (78796800, 1) ,(94694401, 2) ,(126230402, 3) - ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) - ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) - ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) - ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) - ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) - ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) - ,(915148821, 22); - - -CREATE TABLE procs_priv ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) binary DEFAULT '' NOT NULL, - Routine_name char(64) binary DEFAULT '' NOT NULL, - Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, - Grantor char(77) DEFAULT '' NOT NULL, - Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, - Timestamp timestamp(14), - PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), - KEY Grantor (Grantor) -) engine=MyISAM -CHARACTER SET utf8 COLLATE utf8_bin -comment='Procedure privileges'; - - -CREATE TABLE proc ( - db char(64) collate utf8_bin DEFAULT '' NOT NULL, - name char(64) DEFAULT '' NOT NULL, - type enum('FUNCTION','PROCEDURE') 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 DEFAULT '' NOT NULL, - returns char(64) DEFAULT '' NOT NULL, - body longblob DEFAULT '' NOT NULL, - definer char(77) collate utf8_bin DEFAULT '' NOT NULL, - created timestamp, - modified timestamp, - sql_mode set( - 'REAL_AS_FLOAT', - 'PIPES_AS_CONCAT', - 'ANSI_QUOTES', - 'IGNORE_SPACE', - 'NOT_USED', - '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' - ) DEFAULT '' NOT NULL, - comment char(64) collate utf8_bin DEFAULT '' NOT NULL, - PRIMARY KEY (db,name,type) -) character set utf8 comment='Stored Procedures'; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index cefa1bae6d5..8920997b15d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -299,6 +299,8 @@ our $path_ndb_examples_dir; our $exe_ndb_example; our $path_ndb_testrun_log; +our $path_sql_dir; + our @data_dir_lst; our $used_binlog_format; @@ -1497,12 +1499,16 @@ sub executable_setup () { $exe_mysql_fix_system_tables= mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", "$path_client_bindir/mysql_fix_privilege_tables"); + } + # Look for SQL scripts directory + $path_sql_dir= mtr_path_exists("$glob_basedir/share", + "$glob_basedir/scripts"); + # Look for mysql_fix_privilege_tables.sql script $file_mysql_fix_privilege_tables= - mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", - "$glob_basedir/share/mysql_fix_privilege_tables.sql"); + mtr_file_exists("$path_sql_dir/mysql_fix_privilege_tables.sql"); if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) { @@ -1940,6 +1946,7 @@ sub environment_setup () { "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'}"; $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; + } $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; @@ -2856,38 +2863,11 @@ sub install_db ($$) { my $type= shift; my $data_dir= shift; - my $init_db_sql= "lib/init_db.sql"; - my $init_db_sql_tmp= "/tmp/init_db.sql$$"; - my $args; - mtr_report("Installing \u$type Database"); - open(IN, $init_db_sql) - or mtr_error("Can't open $init_db_sql: $!"); - open(OUT, ">", $init_db_sql_tmp) - or mtr_error("Can't write to $init_db_sql_tmp: $!"); - while (<IN>) - { - chomp; - s/\@HOSTNAME\@/$glob_hostname/; - if ( /^\s*$/ ) - { - print OUT "\n"; - } - elsif (/;$/) - { - print OUT "$_\n"; - } - else - { - print OUT "$_ "; - } - } - close OUT; - close IN; + my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--bootstrap"); mtr_add_arg($args, "--basedir=%s", $path_my_basedir); @@ -2921,21 +2901,44 @@ sub install_db ($$) { # ---------------------------------------------------------------------- $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args); + # ---------------------------------------------------------------------- + # Create the bootstrap.sql file + # ---------------------------------------------------------------------- + my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql$$"; + + # Use the mysql database for system tables + mtr_tofile($bootstrap_sql_file, "use mysql"); + + # Add the offical mysql system tables and initial system data + # for a prodcuction system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", + $bootstrap_sql_file); + + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website + mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", + $bootstrap_sql_file); + + # Fill help tables, just an empty file when running from bk repo + # but will be replaced by a real fill_help_tables.sql when + # building the source dist + mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", + $bootstrap_sql_file); + # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log, "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); - if ( mtr_run($exe_mysqld_bootstrap, $args, $init_db_sql_tmp, + if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, $path_bootstrap_log, $path_bootstrap_log, "", { append_log_file => 1 }) != 0 ) { - unlink($init_db_sql_tmp); mtr_error("Error executing mysqld --bootstrap\n" . - "Could not install $type test DBs"); + "Could not install system database, see $path_bootstrap_log"); } - unlink($init_db_sql_tmp); } diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 1dcbc693597..11c1431de7b 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -509,9 +509,11 @@ drop database mysqltest; select database(); database() NULL +create user mysqltest_1; select database(), user(); database() user() NULL mysqltest_1@localhost +drop user mysqltest_1; use test; create table t1 (a int, index `primary` (a)); ERROR 42000: Incorrect index name 'primary' diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 8c7e39e0e90..3a098308b49 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -202,6 +202,7 @@ drop table t1,t2; SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; x 1 +create user mysqltest_1; create table t1 select 1 as a; select 2 as a from (select * from t1) b; ERROR 3D000: No database selected @@ -380,3 +381,4 @@ ID DATA FID select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID; ID DATA FID drop table t1, t2; +drop user mysqltest_1; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index f3114dc55dd..af2d4bed592 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -701,7 +701,7 @@ select * from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user'; TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI # -user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI # +user User NULL mysql 0 mysql PRIMARY 2 A 3 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI # drop table t1; drop table t2; drop table t3; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 1f93d727561..f92540a0d55 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -20,63 +20,43 @@ mysql.user OK 1 1 1 -1 -1 @hadShowDbPriv:=1 1 1 1 -1 -1 @hadCreateViewPriv:=1 1 1 1 -1 -1 @hadCreateRoutinePriv:=1 1 1 1 -1 -1 @hadCreateUserPriv:=1 1 1 1 -1 -1 Run it again - should say already completed @hadGrantPriv:=1 1 1 1 -1 -1 @hadShowDbPriv:=1 1 1 1 -1 -1 @hadCreateViewPriv:=1 1 1 1 -1 -1 @hadCreateRoutinePriv:=1 1 1 1 -1 -1 @hadCreateUserPriv:=1 1 1 1 -1 -1 Force should run it regardless of wheter it's been run before mysql.columns_priv OK mysql.db OK @@ -99,29 +79,19 @@ mysql.user OK 1 1 1 -1 -1 @hadShowDbPriv:=1 1 1 1 -1 -1 @hadCreateViewPriv:=1 1 1 1 -1 -1 @hadCreateRoutinePriv:=1 1 1 1 -1 -1 @hadCreateUserPriv:=1 1 1 1 -1 -1 diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 1198efc4f3b..26b3f352a1f 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -45,7 +45,7 @@ db1_secret select * from db1_secret.t1; ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1' create procedure db1_secret.dummy() begin end; -ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'%' to database 'db1_secret' drop procedure db1_secret.dummy; ERROR 42000: PROCEDURE db1_secret.dummy does not exist select * from t1; @@ -76,9 +76,9 @@ ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' select db1_secret.db(); ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' call db1_secret.stamp(6); -ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'%' to database 'db1_secret' select db1_secret.db(); -ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' +ERROR 42000: Access denied for user ''@'%' to database 'db1_secret' drop database if exists db2; create database db2; use db2; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index eef6ec85bfa..8e55bf62ba6 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -406,12 +406,14 @@ select database(); drop database mysqltest; select database(); -# Connect without a database +# Connect without a database as user mysqltest_1 +create user mysqltest_1; connect (user1,localhost,mysqltest_1,,*NO-ONE*); connection user1; select database(), user(); connection default; disconnect user1; +drop user mysqltest_1; use test; # diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 3ad33dddcbe..4d8a8e3c3af 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -99,7 +99,8 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; # # Test for select if database is not selected. # -# Connect without a database +# Connect without a database as user mysqltest_1 +create user mysqltest_1; create table t1 select 1 as a; connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connection con1; @@ -271,4 +272,8 @@ select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID); select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID; drop table t1, t2; +disconnect con1; +connection default; +drop user mysqltest_1; + # End of 4.1 tests diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 66128e56515..d08a9e3f83d 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -395,6 +395,8 @@ delete from mysql.user where user like 'mysqltest\_1'; flush privileges; drop database mysqltest_1; +--source include/add_anonymous_users.inc + # But anonymous users can't change their password connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection n5; @@ -403,6 +405,8 @@ set password = password("changed"); disconnect n5; connection default; +--source include/delete_anonymous_users.inc + # Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in # multi-threaded environment". We should be able to execute FLUSH diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index 7e17a03ec21..c2e31621744 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -2,6 +2,8 @@ -- source include/not_embedded.inc -- source include/have_query_cache.inc +--source include/add_anonymous_users.inc + # # Test grants with query cache # @@ -71,6 +73,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; + # Don't use '' as user because it will pick Unix login connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK); connection unkuser; @@ -150,4 +153,7 @@ drop database mysqltest; set GLOBAL query_cache_size=default; +--source include/delete_anonymous_users.inc + + # End of 4.1 tests diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test index cf98f608982..c9a18a4003d 100644 --- a/mysql-test/t/init_connect.test +++ b/mysql-test/t/init_connect.test @@ -2,6 +2,8 @@ # Test of init_connect variable # +--source include/add_anonymous_users.inc + # should work with embedded server after mysqltest is fixed -- source include/not_embedded.inc connect (con0,localhost,root,,); @@ -41,6 +43,8 @@ disconnect con3; disconnect con4; disconnect con5; +--source include/delete_anonymous_users.inc + --echo End of 4.1 tests # # Test 5.* features diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index a279b715003..d670bb55a18 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -138,6 +138,10 @@ DROP DATABASE mysqltest_1; # # Bug#16986 - Deadlock condition with MyISAM tables # + +# Need a matching user in mysql.user for multi-table select +--source include/add_anonymous_users.inc + connection locker; use mysql; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; @@ -214,6 +218,8 @@ UNLOCK TABLES; connection default; DROP TABLE t1; +--source include/delete_anonymous_users.inc + # # Bug #17264: MySQL Server freeze # diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index a1ceddcd183..8fda2ede948 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -583,8 +583,8 @@ drop table t1; # Test auto_increment # -connect (con1,localhost,,,test); -connect (con2,localhost,,,test); +connect (con1,localhost,root,,test); +connect (con2,localhost,root,,test); create table t1 (counter int(64) NOT NULL auto_increment, @@ -617,7 +617,7 @@ drop table t1; # # Bug #17249 delete statement with join where clause fails # when table do not have pk -# + # create table t1 (a int) engine=ndb; create table t2 (a int) engine=ndb; diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 5867140fabb..19b024a043f 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -336,8 +336,8 @@ drop table t1; # bug#7798 create table t1(a int primary key, b int not null, index(b)); insert into t1 values (1,1), (2,2); -connect (con1,localhost,,,test); -connect (con2,localhost,,,test); +connect (con1,localhost,root,,test); +connect (con2,localhost,root,,test); connection con1; set autocommit=0; begin; diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test index 3bc735b60d4..97cce08fce0 100644 --- a/mysql-test/t/ndb_multi.test +++ b/mysql-test/t/ndb_multi.test @@ -19,8 +19,8 @@ select * from t2; show status like 'handler_discover%'; # Check dropping and recreating table on same server -connect (con1,localhost,,,test); -connect (con2,localhost,,,test); +connect (con1,localhost,root,,test); +connect (con2,localhost,root,,test); connection con1; select * from t1; connection con2; diff --git a/mysql-test/t/overflow.test b/mysql-test/t/overflow.test index c930707413b..a62ef9c4cd2 100644 --- a/mysql-test/t/overflow.test +++ b/mysql-test/t/overflow.test @@ -1,4 +1,4 @@ -connect (con1,localhost,boo,,); +connect (con1,localhost,root,,); connection con1; -- error 1064,1102,1280 drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 81f0e8a0af7..a05ec4fc714 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -1,3 +1,6 @@ +# Test need anonymous user when connection are made as "zedjzlcsjhd" +source include/add_anonymous_users.inc; + source include/master-slave.inc; # Clean up old slave's binlogs. @@ -20,8 +23,8 @@ connection master; connect (con1,localhost,root,,); connect (con2,localhost,root,,); # We want to connect as an unprivileged user. But if we use user="" then this -# will pick the Unix login, which will cause problems if you're running the test -# as root. +# will pick the Unix login, which will cause problems if you're running the +# test as root. connect (con3,localhost,zedjzlcsjhd,,); # We are going to use SET PSEUDO_THREAD_ID in this test; @@ -201,4 +204,7 @@ select * from t1; connection master; drop table t1; +# Delete the anonymous users +source include/delete_anonymous_users.inc; + # End of 5.0 tests diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 92405bac137..0d564727fe3 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -37,7 +37,7 @@ begin; --error 1399 create table t2 (a int); -connect (con1,localhost,,,); +connect (con1,localhost,root,,); connection con1; --error 1440 diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 1fad4befe6e..d1c3bd82050 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -32,8 +32,7 @@ bin_SCRIPTS = @server_scripts@ \ mysql_explain_log \ mysql_tableinfo \ mysql_upgrade_shell \ - mysqld_multi \ - mysql_create_system_tables + mysqld_multi noinst_SCRIPTS = make_binary_distribution \ make_sharedlib_distribution \ @@ -60,15 +59,18 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ mysqld_multi.sh \ mysql_tableinfo.sh \ mysql_upgrade_shell.sh \ - mysqld_safe.sh \ - mysql_create_system_tables.sh + mysqld_safe.sh EXTRA_DIST = $(EXTRA_SCRIPTS) \ mysqlaccess.conf \ mysqlbug \ - make_win_bin_dist + make_win_bin_dist \ + mysql_fix_privilege_tables.sql.in -dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql +dist_pkgdata_DATA = fill_help_tables.sql \ + mysql_fix_privilege_tables.sql \ + mysql_system_tables.sql \ + mysql_test_data_timezone.sql # mysqlbug should be distributed built so that people can report build # failures with it. @@ -99,6 +101,14 @@ DISTCLEANFILES = mysqlbug # We want the right version and configure comand line in mysqlbug mysqlbug: ${top_builddir}/config.status mysqlbug.sh +# Build mysql_fix_privilege_tables.sql from the files that contain +# the system tables for this version of MySQL plus any commands +# needed to upgrade the system tables from an older version +mysql_fix_privilege_tables.sql: mysql_fix_privilege_tables.sql.in \ + mysql_system_tables.sql + @echo "Building $@"; + @cat mysql_system_tables.sql $@.in > $@ + SUFFIXES = .sh .sh: diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh deleted file mode 100644 index 9292b329a3e..00000000000 --- a/scripts/mysql_create_system_tables.sh +++ /dev/null @@ -1,779 +0,0 @@ -#!/bin/sh -# Copyright (C) 1997-2003 MySQL AB -# -# 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-1301 USA - -# This script writes on stdout SQL commands to generate all not -# existing MySQL system tables. It also replaces the help tables with -# new context from the manual (from fill_help_tables.sql). - -# $1 - "test" or "real" or "verbose" variant of database -# $2 - path to mysql-database directory -# $3 - hostname -# $4 - windows option - -if test "$1" = "" -then - echo " -This script writes on stdout SQL commands to generate all not -existing MySQL system tables. It also replaces the help tables with -new context from the manual (from fill_help_tables.sql). - -Usage: - mysql_create_system_tables [test|verbose|real] <path to mysql-database directory> <hostname> <windows option> -" - exit -fi - -mdata=$2 -hostname=$3 -windows=$4 - -# Initialize variables -c_d="" i_d="" -c_h="" i_h="" -c_u="" i_u="" -c_f="" i_f="" -c_t="" c_c="" -c_ht="" -c_hc="" -c_hr="" -c_hk="" -i_ht="" -c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls="" -i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls="" -c_p="" c_pp="" - -# Check for old tables -if test ! -f $mdata/db.frm -then - if test "$1" = "verbose" ; then - echo "Preparing db table" 1>&2; - fi - - # mysqld --bootstrap wants one command/line - c_d="$c_d CREATE TABLE db (" - c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL," - c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL," - c_d="$c_d User char(16) binary DEFAULT '' NOT NULL," - c_d="$c_d Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_d="$c_d PRIMARY KEY Host (Host,Db,User)," - c_d="$c_d KEY User (User)" - c_d="$c_d ) engine=MyISAM" - c_d="$c_d CHARACTER SET utf8 COLLATE utf8_bin" - c_d="$c_d comment='Database privileges';" - - i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); - INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');" -fi - -if test ! -f $mdata/host.frm -then - if test "$1" = "verbose" ; then - echo "Preparing host table" 1>&2; - fi - - c_h="$c_h CREATE TABLE host (" - c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL," - c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL," - c_h="$c_h Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_h="$c_h PRIMARY KEY Host (Host,Db)" - c_h="$c_h ) engine=MyISAM" - c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin" - c_h="$c_h comment='Host privileges; Merged with database privileges';" -fi - -if test ! -f $mdata/user.frm -then - if test "$1" = "verbose" ; then - echo "Preparing user table" 1>&2; - fi - - c_u="$c_u CREATE TABLE user (" - c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL," - c_u="$c_u User char(16) binary DEFAULT '' NOT NULL," - c_u="$c_u Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL," - c_u="$c_u Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL," - c_u="$c_u ssl_cipher BLOB NOT NULL," - c_u="$c_u x509_issuer BLOB NOT NULL," - c_u="$c_u x509_subject BLOB NOT NULL," - c_u="$c_u max_questions int(11) unsigned DEFAULT 0 NOT NULL," - c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL," - c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL," - c_u="$c_u max_user_connections int(11) unsigned DEFAULT 0 NOT NULL," - c_u="$c_u PRIMARY KEY Host (Host,User)" - c_u="$c_u ) engine=MyISAM" - c_u="$c_u CHARACTER SET utf8 COLLATE utf8_bin" - c_u="$c_u comment='Users and global privileges';" - - if test "$1" = "test" - then - i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); - INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); - REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); - INSERT INTO user (host,user) values ('localhost',''); - INSERT INTO user (host,user) values ('$hostname','');" - else - i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);" - if test "$windows" = "0" - then - i_u="$i_u - INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); - INSERT INTO user (host,user) values ('$hostname',''); - INSERT INTO user (host,user) values ('localhost','');" - else - i_u="$i_u - INSERT INTO user (host,user) VALUES ('localhost','');" - fi - fi -fi - -if test ! -f $mdata/func.frm -then - if test "$1" = "verbose" ; then - echo "Preparing func table" 1>&2; - fi - - c_f="$c_f CREATE TABLE func (" - c_f="$c_f name char(64) binary DEFAULT '' NOT NULL," - c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL," - c_f="$c_f dl char(128) DEFAULT '' NOT NULL," - c_f="$c_f type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL," - c_f="$c_f PRIMARY KEY (name)" - c_f="$c_f ) engine=MyISAM" - c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin" - c_f="$c_f comment='User defined functions';" -fi - -if test ! -f $mdata/tables_priv.frm -then - if test "$1" = "verbose" ; then - echo "Preparing tables_priv table" 1>&2; - fi - - c_t="$c_t CREATE TABLE tables_priv (" - c_t="$c_t Host char(60) binary DEFAULT '' NOT NULL," - c_t="$c_t Db char(64) binary DEFAULT '' NOT NULL," - c_t="$c_t User char(16) binary DEFAULT '' NOT NULL," - c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL," - c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL," - c_t="$c_t Timestamp timestamp(14)," - c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL," - c_t="$c_t Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL," - c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name)," - c_t="$c_t KEY Grantor (Grantor)" - c_t="$c_t ) engine=MyISAM" - c_t="$c_t CHARACTER SET utf8 COLLATE utf8_bin" - c_t="$c_t comment='Table privileges';" -fi - -if test ! -f $mdata/columns_priv.frm -then - if test "$1" = "verbose" ; then - echo "Preparing columns_priv table" 1>&2; - fi - - c_c="$c_c CREATE TABLE columns_priv (" - c_c="$c_c Host char(60) binary DEFAULT '' NOT NULL," - c_c="$c_c Db char(64) binary DEFAULT '' NOT NULL," - c_c="$c_c User char(16) binary DEFAULT '' NOT NULL," - c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL," - c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL," - c_c="$c_c Timestamp timestamp(14)," - c_c="$c_c Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL," - c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)" - c_c="$c_c ) engine=MyISAM" - c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin" - c_c="$c_c comment='Column privileges';" -fi - -if test ! -f $mdata/procs_priv.frm -then - if test "$1" = "verbose" ; then - echo "Preparing procs_priv table" 1>&2; - fi - - c_pp="$c_pp CREATE TABLE procs_priv (" - c_pp="$c_pp Host char(60) binary DEFAULT '' NOT NULL," - c_pp="$c_pp Db char(64) binary DEFAULT '' NOT NULL," - c_pp="$c_pp User char(16) binary DEFAULT '' NOT NULL," - c_pp="$c_pp Routine_name char(64) binary DEFAULT '' NOT NULL," - c_pp="$c_pp Routine_type enum('FUNCTION','PROCEDURE') NOT NULL," - c_pp="$c_pp Grantor char(77) DEFAULT '' NOT NULL," - c_pp="$c_pp Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL," - c_pp="$c_pp Timestamp timestamp(14)," - c_pp="$c_pp PRIMARY KEY (Host,Db,User,Routine_name,Routine_type)," - c_pp="$c_pp KEY Grantor (Grantor)" - c_pp="$c_pp ) engine=MyISAM" - c_pp="$c_pp CHARACTER SET utf8 COLLATE utf8_bin" - c_pp="$c_pp comment='Procedure privileges';" -fi - -if test ! -f $mdata/help_topic.frm -then - if test "$1" = "verbose" ; then - echo "Preparing help_topic table" 1>&2; - fi - - c_ht="$c_ht CREATE TABLE help_topic (" - c_ht="$c_ht help_topic_id int unsigned not null," - c_ht="$c_ht name char(64) not null," - c_ht="$c_ht help_category_id smallint unsigned not null," - c_ht="$c_ht description text not null," - c_ht="$c_ht example text not null," - c_ht="$c_ht url char(128) not null," - c_ht="$c_ht primary key (help_topic_id)," - c_ht="$c_ht unique index (name)" - c_ht="$c_ht ) engine=MyISAM" - c_ht="$c_ht CHARACTER SET utf8" - c_ht="$c_ht comment='help topics';" -fi - -old_categories="yes" - -if test ! -f $mdata/help_category.frm -then - if test "$1" = "verbose" ; then - echo "Preparing help_category table" 1>&2; - fi - - c_hc="$c_hc CREATE TABLE help_category (" - c_hc="$c_hc help_category_id smallint unsigned not null," - c_hc="$c_hc name char(64) not null," - c_hc="$c_hc parent_category_id smallint unsigned null," - c_hc="$c_hc url char(128) not null," - c_hc="$c_hc primary key (help_category_id)," - c_hc="$c_hc unique index (name)" - c_hc="$c_hc ) engine=MyISAM" - c_hc="$c_hc CHARACTER SET utf8" - c_hc="$c_hc comment='help categories';" -fi - -if test ! -f $mdata/help_keyword.frm -then - if test "$1" = "verbose" ; then - echo "Preparing help_keyword table" 1>&2; - fi - - c_hk="$c_hk CREATE TABLE help_keyword (" - c_hk="$c_hk help_keyword_id int unsigned not null," - c_hk="$c_hk name char(64) not null," - c_hk="$c_hk primary key (help_keyword_id)," - c_hk="$c_hk unique index (name)" - c_hk="$c_hk ) engine=MyISAM" - c_hk="$c_hk CHARACTER SET utf8" - c_hk="$c_hk comment='help keywords';" -fi - -if test ! -f $mdata/help_relation.frm -then - if test "$1" = "verbose" ; then - echo "Preparing help_relation table" 1>&2; - fi - - c_hr="$c_hr CREATE TABLE help_relation (" - c_hr="$c_hr help_topic_id int unsigned not null references help_topic," - c_hr="$c_hr help_keyword_id int unsigned not null references help_keyword," - c_hr="$c_hr primary key (help_keyword_id, help_topic_id)" - c_hr="$c_hr ) engine=MyISAM" - c_hr="$c_hr CHARACTER SET utf8" - c_hr="$c_hr comment='keyword-topic relation';" -fi - -if test ! -f $mdata/time_zone_name.frm -then - if test "$1" = "verbose" ; then - echo "Preparing time_zone_name table" 1>&2; - fi - - c_tzn="$c_tzn CREATE TABLE time_zone_name (" - c_tzn="$c_tzn Name char(64) NOT NULL," - c_tzn="$c_tzn Time_zone_id int unsigned NOT NULL," - c_tzn="$c_tzn PRIMARY KEY Name (Name)" - c_tzn="$c_tzn ) engine=MyISAM CHARACTER SET utf8" - c_tzn="$c_tzn comment='Time zone names';" - - if test "$1" = "test" - then - i_tzn="$i_tzn INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES" - i_tzn="$i_tzn ('MET', 1), ('UTC', 2), ('Universal', 2), " - i_tzn="$i_tzn ('Europe/Moscow',3), ('leap/Europe/Moscow',4), " - i_tzn="$i_tzn ('Japan', 5);" - fi -fi - -if test ! -f $mdata/time_zone.frm -then - if test "$1" = "verbose" ; then - echo "Preparing time_zone table" 1>&2; - fi - - c_tz="$c_tz CREATE TABLE time_zone (" - c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment," - c_tz="$c_tz Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," - c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)" - c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8" - c_tz="$c_tz comment='Time zones';" - - if test "$1" = "test" - then - i_tz="$i_tz INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)" - i_tz="$i_tz VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');" - fi -fi - -if test ! -f $mdata/time_zone_transition.frm -then - if test "$1" = "verbose" ; then - echo "Preparing time_zone_transition table" 1>&2; - fi - - c_tzt="$c_tzt CREATE TABLE time_zone_transition (" - c_tzt="$c_tzt Time_zone_id int unsigned NOT NULL," - c_tzt="$c_tzt Transition_time bigint signed NOT NULL," - c_tzt="$c_tzt Transition_type_id int unsigned NOT NULL," - c_tzt="$c_tzt PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)" - c_tzt="$c_tzt ) engine=MyISAM CHARACTER SET utf8" - c_tzt="$c_tzt comment='Time zone transitions';" - - if test "$1" = "test" - then - i_tzt="$i_tzt INSERT INTO time_zone_transition" - i_tzt="$i_tzt (Time_zone_id, Transition_time, Transition_type_id)" - i_tzt="$i_tzt VALUES" - i_tzt="$i_tzt (1, -1693706400, 0) ,(1, -1680483600, 1)" - i_tzt="$i_tzt ,(1, -1663455600, 2) ,(1, -1650150000, 3)" - i_tzt="$i_tzt ,(1, -1632006000, 2) ,(1, -1618700400, 3)" - i_tzt="$i_tzt ,(1, -938905200, 2) ,(1, -857257200, 3)" - i_tzt="$i_tzt ,(1, -844556400, 2) ,(1, -828226800, 3)" - i_tzt="$i_tzt ,(1, -812502000, 2) ,(1, -796777200, 3)" - i_tzt="$i_tzt ,(1, 228877200, 2) ,(1, 243997200, 3)" - i_tzt="$i_tzt ,(1, 260326800, 2) ,(1, 276051600, 3)" - i_tzt="$i_tzt ,(1, 291776400, 2) ,(1, 307501200, 3)" - i_tzt="$i_tzt ,(1, 323830800, 2) ,(1, 338950800, 3)" - i_tzt="$i_tzt ,(1, 354675600, 2) ,(1, 370400400, 3)" - i_tzt="$i_tzt ,(1, 386125200, 2) ,(1, 401850000, 3)" - i_tzt="$i_tzt ,(1, 417574800, 2) ,(1, 433299600, 3)" - i_tzt="$i_tzt ,(1, 449024400, 2) ,(1, 465354000, 3)" - i_tzt="$i_tzt ,(1, 481078800, 2) ,(1, 496803600, 3)" - i_tzt="$i_tzt ,(1, 512528400, 2) ,(1, 528253200, 3)" - i_tzt="$i_tzt ,(1, 543978000, 2) ,(1, 559702800, 3)" - i_tzt="$i_tzt ,(1, 575427600, 2) ,(1, 591152400, 3)" - i_tzt="$i_tzt ,(1, 606877200, 2) ,(1, 622602000, 3)" - i_tzt="$i_tzt ,(1, 638326800, 2) ,(1, 654656400, 3)" - i_tzt="$i_tzt ,(1, 670381200, 2) ,(1, 686106000, 3)" - i_tzt="$i_tzt ,(1, 701830800, 2) ,(1, 717555600, 3)" - i_tzt="$i_tzt ,(1, 733280400, 2) ,(1, 749005200, 3)" - i_tzt="$i_tzt ,(1, 764730000, 2) ,(1, 780454800, 3)" - i_tzt="$i_tzt ,(1, 796179600, 2) ,(1, 811904400, 3)" - i_tzt="$i_tzt ,(1, 828234000, 2) ,(1, 846378000, 3)" - i_tzt="$i_tzt ,(1, 859683600, 2) ,(1, 877827600, 3)" - i_tzt="$i_tzt ,(1, 891133200, 2) ,(1, 909277200, 3)" - i_tzt="$i_tzt ,(1, 922582800, 2) ,(1, 941331600, 3)" - i_tzt="$i_tzt ,(1, 954032400, 2) ,(1, 972781200, 3)" - i_tzt="$i_tzt ,(1, 985482000, 2) ,(1, 1004230800, 3)" - i_tzt="$i_tzt ,(1, 1017536400, 2) ,(1, 1035680400, 3)" - i_tzt="$i_tzt ,(1, 1048986000, 2) ,(1, 1067130000, 3)" - i_tzt="$i_tzt ,(1, 1080435600, 2) ,(1, 1099184400, 3)" - i_tzt="$i_tzt ,(1, 1111885200, 2) ,(1, 1130634000, 3)" - i_tzt="$i_tzt ,(1, 1143334800, 2) ,(1, 1162083600, 3)" - i_tzt="$i_tzt ,(1, 1174784400, 2) ,(1, 1193533200, 3)" - i_tzt="$i_tzt ,(1, 1206838800, 2) ,(1, 1224982800, 3)" - i_tzt="$i_tzt ,(1, 1238288400, 2) ,(1, 1256432400, 3)" - i_tzt="$i_tzt ,(1, 1269738000, 2) ,(1, 1288486800, 3)" - i_tzt="$i_tzt ,(1, 1301187600, 2) ,(1, 1319936400, 3)" - i_tzt="$i_tzt ,(1, 1332637200, 2) ,(1, 1351386000, 3)" - i_tzt="$i_tzt ,(1, 1364691600, 2) ,(1, 1382835600, 3)" - i_tzt="$i_tzt ,(1, 1396141200, 2) ,(1, 1414285200, 3)" - i_tzt="$i_tzt ,(1, 1427590800, 2) ,(1, 1445734800, 3)" - i_tzt="$i_tzt ,(1, 1459040400, 2) ,(1, 1477789200, 3)" - i_tzt="$i_tzt ,(1, 1490490000, 2) ,(1, 1509238800, 3)" - i_tzt="$i_tzt ,(1, 1521939600, 2) ,(1, 1540688400, 3)" - i_tzt="$i_tzt ,(1, 1553994000, 2) ,(1, 1572138000, 3)" - i_tzt="$i_tzt ,(1, 1585443600, 2) ,(1, 1603587600, 3)" - i_tzt="$i_tzt ,(1, 1616893200, 2) ,(1, 1635642000, 3)" - i_tzt="$i_tzt ,(1, 1648342800, 2) ,(1, 1667091600, 3)" - i_tzt="$i_tzt ,(1, 1679792400, 2) ,(1, 1698541200, 3)" - i_tzt="$i_tzt ,(1, 1711846800, 2) ,(1, 1729990800, 3)" - i_tzt="$i_tzt ,(1, 1743296400, 2) ,(1, 1761440400, 3)" - i_tzt="$i_tzt ,(1, 1774746000, 2) ,(1, 1792890000, 3)" - i_tzt="$i_tzt ,(1, 1806195600, 2) ,(1, 1824944400, 3)" - i_tzt="$i_tzt ,(1, 1837645200, 2) ,(1, 1856394000, 3)" - i_tzt="$i_tzt ,(1, 1869094800, 2) ,(1, 1887843600, 3)" - i_tzt="$i_tzt ,(1, 1901149200, 2) ,(1, 1919293200, 3)" - i_tzt="$i_tzt ,(1, 1932598800, 2) ,(1, 1950742800, 3)" - i_tzt="$i_tzt ,(1, 1964048400, 2) ,(1, 1982797200, 3)" - i_tzt="$i_tzt ,(1, 1995498000, 2) ,(1, 2014246800, 3)" - i_tzt="$i_tzt ,(1, 2026947600, 2) ,(1, 2045696400, 3)" - i_tzt="$i_tzt ,(1, 2058397200, 2) ,(1, 2077146000, 3)" - i_tzt="$i_tzt ,(1, 2090451600, 2) ,(1, 2108595600, 3)" - i_tzt="$i_tzt ,(1, 2121901200, 2) ,(1, 2140045200, 3)" - i_tzt="$i_tzt ,(3, -1688265000, 2) ,(3, -1656819048, 1)" - i_tzt="$i_tzt ,(3, -1641353448, 2) ,(3, -1627965048, 3)" - i_tzt="$i_tzt ,(3, -1618716648, 1) ,(3, -1596429048, 3)" - i_tzt="$i_tzt ,(3, -1593829848, 5) ,(3, -1589860800, 4)" - i_tzt="$i_tzt ,(3, -1542427200, 5) ,(3, -1539493200, 6)" - i_tzt="$i_tzt ,(3, -1525323600, 5) ,(3, -1522728000, 4)" - i_tzt="$i_tzt ,(3, -1491188400, 7) ,(3, -1247536800, 4)" - i_tzt="$i_tzt ,(3, 354920400, 5) ,(3, 370728000, 4)" - i_tzt="$i_tzt ,(3, 386456400, 5) ,(3, 402264000, 4)" - i_tzt="$i_tzt ,(3, 417992400, 5) ,(3, 433800000, 4)" - i_tzt="$i_tzt ,(3, 449614800, 5) ,(3, 465346800, 8)" - i_tzt="$i_tzt ,(3, 481071600, 9) ,(3, 496796400, 8)" - i_tzt="$i_tzt ,(3, 512521200, 9) ,(3, 528246000, 8)" - i_tzt="$i_tzt ,(3, 543970800, 9) ,(3, 559695600, 8)" - i_tzt="$i_tzt ,(3, 575420400, 9) ,(3, 591145200, 8)" - i_tzt="$i_tzt ,(3, 606870000, 9) ,(3, 622594800, 8)" - i_tzt="$i_tzt ,(3, 638319600, 9) ,(3, 654649200, 8)" - i_tzt="$i_tzt ,(3, 670374000, 10) ,(3, 686102400, 11)" - i_tzt="$i_tzt ,(3, 695779200, 8) ,(3, 701812800, 5)" - i_tzt="$i_tzt ,(3, 717534000, 4) ,(3, 733273200, 9)" - i_tzt="$i_tzt ,(3, 748998000, 8) ,(3, 764722800, 9)" - i_tzt="$i_tzt ,(3, 780447600, 8) ,(3, 796172400, 9)" - i_tzt="$i_tzt ,(3, 811897200, 8) ,(3, 828226800, 9)" - i_tzt="$i_tzt ,(3, 846370800, 8) ,(3, 859676400, 9)" - i_tzt="$i_tzt ,(3, 877820400, 8) ,(3, 891126000, 9)" - i_tzt="$i_tzt ,(3, 909270000, 8) ,(3, 922575600, 9)" - i_tzt="$i_tzt ,(3, 941324400, 8) ,(3, 954025200, 9)" - i_tzt="$i_tzt ,(3, 972774000, 8) ,(3, 985474800, 9)" - i_tzt="$i_tzt ,(3, 1004223600, 8) ,(3, 1017529200, 9)" - i_tzt="$i_tzt ,(3, 1035673200, 8) ,(3, 1048978800, 9)" - i_tzt="$i_tzt ,(3, 1067122800, 8) ,(3, 1080428400, 9)" - i_tzt="$i_tzt ,(3, 1099177200, 8) ,(3, 1111878000, 9)" - i_tzt="$i_tzt ,(3, 1130626800, 8) ,(3, 1143327600, 9)" - i_tzt="$i_tzt ,(3, 1162076400, 8) ,(3, 1174777200, 9)" - i_tzt="$i_tzt ,(3, 1193526000, 8) ,(3, 1206831600, 9)" - i_tzt="$i_tzt ,(3, 1224975600, 8) ,(3, 1238281200, 9)" - i_tzt="$i_tzt ,(3, 1256425200, 8) ,(3, 1269730800, 9)" - i_tzt="$i_tzt ,(3, 1288479600, 8) ,(3, 1301180400, 9)" - i_tzt="$i_tzt ,(3, 1319929200, 8) ,(3, 1332630000, 9)" - i_tzt="$i_tzt ,(3, 1351378800, 8) ,(3, 1364684400, 9)" - i_tzt="$i_tzt ,(3, 1382828400, 8) ,(3, 1396134000, 9)" - i_tzt="$i_tzt ,(3, 1414278000, 8) ,(3, 1427583600, 9)" - i_tzt="$i_tzt ,(3, 1445727600, 8) ,(3, 1459033200, 9)" - i_tzt="$i_tzt ,(3, 1477782000, 8) ,(3, 1490482800, 9)" - i_tzt="$i_tzt ,(3, 1509231600, 8) ,(3, 1521932400, 9)" - i_tzt="$i_tzt ,(3, 1540681200, 8) ,(3, 1553986800, 9)" - i_tzt="$i_tzt ,(3, 1572130800, 8) ,(3, 1585436400, 9)" - i_tzt="$i_tzt ,(3, 1603580400, 8) ,(3, 1616886000, 9)" - i_tzt="$i_tzt ,(3, 1635634800, 8) ,(3, 1648335600, 9)" - i_tzt="$i_tzt ,(3, 1667084400, 8) ,(3, 1679785200, 9)" - i_tzt="$i_tzt ,(3, 1698534000, 8) ,(3, 1711839600, 9)" - i_tzt="$i_tzt ,(3, 1729983600, 8) ,(3, 1743289200, 9)" - i_tzt="$i_tzt ,(3, 1761433200, 8) ,(3, 1774738800, 9)" - i_tzt="$i_tzt ,(3, 1792882800, 8) ,(3, 1806188400, 9)" - i_tzt="$i_tzt ,(3, 1824937200, 8) ,(3, 1837638000, 9)" - i_tzt="$i_tzt ,(3, 1856386800, 8) ,(3, 1869087600, 9)" - i_tzt="$i_tzt ,(3, 1887836400, 8) ,(3, 1901142000, 9)" - i_tzt="$i_tzt ,(3, 1919286000, 8) ,(3, 1932591600, 9)" - i_tzt="$i_tzt ,(3, 1950735600, 8) ,(3, 1964041200, 9)" - i_tzt="$i_tzt ,(3, 1982790000, 8) ,(3, 1995490800, 9)" - i_tzt="$i_tzt ,(3, 2014239600, 8) ,(3, 2026940400, 9)" - i_tzt="$i_tzt ,(3, 2045689200, 8) ,(3, 2058390000, 9)" - i_tzt="$i_tzt ,(3, 2077138800, 8) ,(3, 2090444400, 9)" - i_tzt="$i_tzt ,(3, 2108588400, 8) ,(3, 2121894000, 9)" - i_tzt="$i_tzt ,(3, 2140038000, 8)" - i_tzt="$i_tzt ,(4, -1688265000, 2) ,(4, -1656819048, 1)" - i_tzt="$i_tzt ,(4, -1641353448, 2) ,(4, -1627965048, 3)" - i_tzt="$i_tzt ,(4, -1618716648, 1) ,(4, -1596429048, 3)" - i_tzt="$i_tzt ,(4, -1593829848, 5) ,(4, -1589860800, 4)" - i_tzt="$i_tzt ,(4, -1542427200, 5) ,(4, -1539493200, 6)" - i_tzt="$i_tzt ,(4, -1525323600, 5) ,(4, -1522728000, 4)" - i_tzt="$i_tzt ,(4, -1491188400, 7) ,(4, -1247536800, 4)" - i_tzt="$i_tzt ,(4, 354920409, 5) ,(4, 370728010, 4)" - i_tzt="$i_tzt ,(4, 386456410, 5) ,(4, 402264011, 4)" - i_tzt="$i_tzt ,(4, 417992411, 5) ,(4, 433800012, 4)" - i_tzt="$i_tzt ,(4, 449614812, 5) ,(4, 465346812, 8)" - i_tzt="$i_tzt ,(4, 481071612, 9) ,(4, 496796413, 8)" - i_tzt="$i_tzt ,(4, 512521213, 9) ,(4, 528246013, 8)" - i_tzt="$i_tzt ,(4, 543970813, 9) ,(4, 559695613, 8)" - i_tzt="$i_tzt ,(4, 575420414, 9) ,(4, 591145214, 8)" - i_tzt="$i_tzt ,(4, 606870014, 9) ,(4, 622594814, 8)" - i_tzt="$i_tzt ,(4, 638319615, 9) ,(4, 654649215, 8)" - i_tzt="$i_tzt ,(4, 670374016, 10) ,(4, 686102416, 11)" - i_tzt="$i_tzt ,(4, 695779216, 8) ,(4, 701812816, 5)" - i_tzt="$i_tzt ,(4, 717534017, 4) ,(4, 733273217, 9)" - i_tzt="$i_tzt ,(4, 748998018, 8) ,(4, 764722818, 9)" - i_tzt="$i_tzt ,(4, 780447619, 8) ,(4, 796172419, 9)" - i_tzt="$i_tzt ,(4, 811897219, 8) ,(4, 828226820, 9)" - i_tzt="$i_tzt ,(4, 846370820, 8) ,(4, 859676420, 9)" - i_tzt="$i_tzt ,(4, 877820421, 8) ,(4, 891126021, 9)" - i_tzt="$i_tzt ,(4, 909270021, 8) ,(4, 922575622, 9)" - i_tzt="$i_tzt ,(4, 941324422, 8) ,(4, 954025222, 9)" - i_tzt="$i_tzt ,(4, 972774022, 8) ,(4, 985474822, 9)" - i_tzt="$i_tzt ,(4, 1004223622, 8) ,(4, 1017529222, 9)" - i_tzt="$i_tzt ,(4, 1035673222, 8) ,(4, 1048978822, 9)" - i_tzt="$i_tzt ,(4, 1067122822, 8) ,(4, 1080428422, 9)" - i_tzt="$i_tzt ,(4, 1099177222, 8) ,(4, 1111878022, 9)" - i_tzt="$i_tzt ,(4, 1130626822, 8) ,(4, 1143327622, 9)" - i_tzt="$i_tzt ,(4, 1162076422, 8) ,(4, 1174777222, 9)" - i_tzt="$i_tzt ,(4, 1193526022, 8) ,(4, 1206831622, 9)" - i_tzt="$i_tzt ,(4, 1224975622, 8) ,(4, 1238281222, 9)" - i_tzt="$i_tzt ,(4, 1256425222, 8) ,(4, 1269730822, 9)" - i_tzt="$i_tzt ,(4, 1288479622, 8) ,(4, 1301180422, 9)" - i_tzt="$i_tzt ,(4, 1319929222, 8) ,(4, 1332630022, 9)" - i_tzt="$i_tzt ,(4, 1351378822, 8) ,(4, 1364684422, 9)" - i_tzt="$i_tzt ,(4, 1382828422, 8) ,(4, 1396134022, 9)" - i_tzt="$i_tzt ,(4, 1414278022, 8) ,(4, 1427583622, 9)" - i_tzt="$i_tzt ,(4, 1445727622, 8) ,(4, 1459033222, 9)" - i_tzt="$i_tzt ,(4, 1477782022, 8) ,(4, 1490482822, 9)" - i_tzt="$i_tzt ,(4, 1509231622, 8) ,(4, 1521932422, 9)" - i_tzt="$i_tzt ,(4, 1540681222, 8) ,(4, 1553986822, 9)" - i_tzt="$i_tzt ,(4, 1572130822, 8) ,(4, 1585436422, 9)" - i_tzt="$i_tzt ,(4, 1603580422, 8) ,(4, 1616886022, 9)" - i_tzt="$i_tzt ,(4, 1635634822, 8) ,(4, 1648335622, 9)" - i_tzt="$i_tzt ,(4, 1667084422, 8) ,(4, 1679785222, 9)" - i_tzt="$i_tzt ,(4, 1698534022, 8) ,(4, 1711839622, 9)" - i_tzt="$i_tzt ,(4, 1729983622, 8) ,(4, 1743289222, 9)" - i_tzt="$i_tzt ,(4, 1761433222, 8) ,(4, 1774738822, 9)" - i_tzt="$i_tzt ,(4, 1792882822, 8) ,(4, 1806188422, 9)" - i_tzt="$i_tzt ,(4, 1824937222, 8) ,(4, 1837638022, 9)" - i_tzt="$i_tzt ,(4, 1856386822, 8) ,(4, 1869087622, 9)" - i_tzt="$i_tzt ,(4, 1887836422, 8) ,(4, 1901142022, 9)" - i_tzt="$i_tzt ,(4, 1919286022, 8) ,(4, 1932591622, 9)" - i_tzt="$i_tzt ,(4, 1950735622, 8) ,(4, 1964041222, 9)" - i_tzt="$i_tzt ,(4, 1982790022, 8) ,(4, 1995490822, 9)" - i_tzt="$i_tzt ,(4, 2014239622, 8) ,(4, 2026940422, 9)" - i_tzt="$i_tzt ,(4, 2045689222, 8) ,(4, 2058390022, 9)" - i_tzt="$i_tzt ,(4, 2077138822, 8) ,(4, 2090444422, 9)" - i_tzt="$i_tzt ,(4, 2108588422, 8) ,(4, 2121894022, 9)" - i_tzt="$i_tzt ,(4, 2140038022, 8)" - i_tzt="$i_tzt ,(5, -1009875600, 1);" - fi -fi - -if test ! -f $mdata/time_zone_transition_type.frm -then - if test "$1" = "verbose" ; then - echo "Preparing time_zone_transition_type table" 1>&2; - fi - - c_tztt="$c_tztt CREATE TABLE time_zone_transition_type (" - c_tztt="$c_tztt Time_zone_id int unsigned NOT NULL," - c_tztt="$c_tztt Transition_type_id int unsigned NOT NULL," - c_tztt="$c_tztt Offset int signed DEFAULT 0 NOT NULL," - c_tztt="$c_tztt Is_DST tinyint unsigned DEFAULT 0 NOT NULL," - c_tztt="$c_tztt Abbreviation char(8) DEFAULT '' NOT NULL," - c_tztt="$c_tztt PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)" - c_tztt="$c_tztt ) engine=MyISAM CHARACTER SET utf8" - c_tztt="$c_tztt comment='Time zone transition types';" - - if test "$1" = "test" - then - i_tztt="$i_tztt INSERT INTO time_zone_transition_type (Time_zone_id," - i_tztt="$i_tztt Transition_type_id, Offset, Is_DST, Abbreviation) VALUES" - i_tztt="$i_tztt (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')" - i_tztt="$i_tztt ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')" - i_tztt="$i_tztt ,(2, 0, 0, 0, 'UTC')" - i_tztt="$i_tztt ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')" - i_tztt="$i_tztt ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')" - i_tztt="$i_tztt ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')" - i_tztt="$i_tztt ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')" - i_tztt="$i_tztt ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')" - i_tztt="$i_tztt ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')" - i_tztt="$i_tztt ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')" - i_tztt="$i_tztt ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')" - i_tztt="$i_tztt ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')" - i_tztt="$i_tztt ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')" - i_tztt="$i_tztt ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')" - i_tztt="$i_tztt ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')" - i_tztt="$i_tztt ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');" - fi -fi - -if test ! -f $mdata/time_zone_leap_second.frm -then - if test "$1" = "verbose" ; then - echo "Preparing time_zone_leap_second table" 1>&2; - fi - - c_tzls="$c_tzls CREATE TABLE time_zone_leap_second (" - c_tzls="$c_tzls Transition_time bigint signed NOT NULL," - c_tzls="$c_tzls Correction int signed NOT NULL," - c_tzls="$c_tzls PRIMARY KEY TranTime (Transition_time)" - c_tzls="$c_tzls ) engine=MyISAM CHARACTER SET utf8" - c_tzls="$c_tzls comment='Leap seconds information for time zones';" - - if test "$1" = "test" - then - i_tzls="$i_tzls INSERT INTO time_zone_leap_second " - i_tzls="$i_tzls (Transition_time, Correction) VALUES " - i_tzls="$i_tzls (78796800, 1) ,(94694401, 2) ,(126230402, 3)" - i_tzls="$i_tzls ,(157766403, 4) ,(189302404, 5) ,(220924805, 6)" - i_tzls="$i_tzls ,(252460806, 7) ,(283996807, 8) ,(315532808, 9)" - i_tzls="$i_tzls ,(362793609, 10) ,(394329610, 11) ,(425865611, 12)" - i_tzls="$i_tzls ,(489024012, 13) ,(567993613, 14) ,(631152014, 15)" - i_tzls="$i_tzls ,(662688015, 16) ,(709948816, 17) ,(741484817, 18)" - i_tzls="$i_tzls ,(773020818, 19) ,(820454419, 20) ,(867715220, 21)" - i_tzls="$i_tzls ,(915148821, 22);" - fi -fi - -if test ! -f $mdata/proc.frm -then - c_p="$c_p CREATE TABLE proc (" - c_p="$c_p db char(64) collate utf8_bin DEFAULT '' NOT NULL," - c_p="$c_p name char(64) DEFAULT '' NOT NULL," - c_p="$c_p type enum('FUNCTION','PROCEDURE') NOT NULL," - c_p="$c_p specific_name char(64) DEFAULT '' NOT NULL," - c_p="$c_p language enum('SQL') DEFAULT 'SQL' NOT NULL," - c_p="$c_p sql_data_access enum('CONTAINS_SQL'," - c_p="$c_p 'NO_SQL'," - c_p="$c_p 'READS_SQL_DATA'," - c_p="$c_p 'MODIFIES_SQL_DATA'" - c_p="$c_p ) DEFAULT 'CONTAINS_SQL' NOT NULL," - c_p="$c_p is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL," - c_p="$c_p security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL," - c_p="$c_p param_list blob DEFAULT '' NOT NULL," - c_p="$c_p returns char(64) DEFAULT '' NOT NULL," - c_p="$c_p body longblob DEFAULT '' NOT NULL," - c_p="$c_p definer char(77) collate utf8_bin DEFAULT '' NOT NULL," - c_p="$c_p created timestamp," - c_p="$c_p modified timestamp," - c_p="$c_p sql_mode set(" - c_p="$c_p 'REAL_AS_FLOAT'," - c_p="$c_p 'PIPES_AS_CONCAT'," - c_p="$c_p 'ANSI_QUOTES'," - c_p="$c_p 'IGNORE_SPACE'," - c_p="$c_p 'NOT_USED'," - c_p="$c_p 'ONLY_FULL_GROUP_BY'," - c_p="$c_p 'NO_UNSIGNED_SUBTRACTION'," - c_p="$c_p 'NO_DIR_IN_CREATE'," - c_p="$c_p 'POSTGRESQL'," - c_p="$c_p 'ORACLE'," - c_p="$c_p 'MSSQL'," - c_p="$c_p 'DB2'," - c_p="$c_p 'MAXDB'," - c_p="$c_p 'NO_KEY_OPTIONS'," - c_p="$c_p 'NO_TABLE_OPTIONS'," - c_p="$c_p 'NO_FIELD_OPTIONS'," - c_p="$c_p 'MYSQL323'," - c_p="$c_p 'MYSQL40'," - c_p="$c_p 'ANSI'," - c_p="$c_p 'NO_AUTO_VALUE_ON_ZERO'," - c_p="$c_p 'NO_BACKSLASH_ESCAPES'," - c_p="$c_p 'STRICT_TRANS_TABLES'," - c_p="$c_p 'STRICT_ALL_TABLES'," - c_p="$c_p 'NO_ZERO_IN_DATE'," - c_p="$c_p 'NO_ZERO_DATE'," - c_p="$c_p 'INVALID_DATES'," - c_p="$c_p 'ERROR_FOR_DIVISION_BY_ZERO'," - c_p="$c_p 'TRADITIONAL'," - c_p="$c_p 'NO_AUTO_CREATE_USER'," - c_p="$c_p 'HIGH_NOT_PRECEDENCE'" - c_p="$c_p ) DEFAULT '' NOT NULL," - c_p="$c_p comment char(64) collate utf8_bin DEFAULT '' NOT NULL," - c_p="$c_p PRIMARY KEY (db,name,type)" - c_p="$c_p ) engine=MyISAM" - c_p="$c_p character set utf8" - c_p="$c_p comment='Stored Procedures';" -fi - -cat << END_OF_DATA -use mysql; -set table_type=myisam; -$c_d -$i_d - -$c_h -$i_h - -$c_u -$i_u - -$c_f -$i_f - -$c_t -$c_c - -$c_ht -$c_hc -$c_hr -$c_hk - -$c_tzn -$i_tzn -$c_tz -$i_tz -$c_tzt -$i_tzt -$c_tztt -$i_tztt -$c_tzls -$i_tzls - -$c_p -$c_pp - -END_OF_DATA - diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index 5493f8fdb4f..a353273dc28 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -175,11 +175,7 @@ s_echo() } s_echo "This script updates all the mysql privilege tables to be usable by" -s_echo "MySQL 4.0 and above." -s_echo "" -s_echo "This is needed if you want to use the new GRANT functions," -s_echo "CREATE AGGREGATE FUNCTION, stored procedures, or" -s_echo "more secure passwords in 4.1" +s_echo "the current version of MySQL" s_echo "" if test $verbose = 1 diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql.in index 5709fb96793..00363b27fdd 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql.in @@ -1,27 +1,19 @@ --- This script converts any old privilege tables to privilege tables suitable --- for MySQL 4.1 +# This part converts any old privilege tables to privilege tables suitable +# for current version of MySQL --- You can safely ignore all 'Duplicate column' and 'Unknown column' errors" --- because these just mean that your tables are already up to date. --- This script is safe to run even if your tables are already up to date! +# You can safely ignore all 'Duplicate column' and 'Unknown column' errors" +# because these just mean that your tables are already up to date. +# This script is safe to run even if your tables are already up to date! --- On unix, you should use the mysql_fix_privilege_tables script to execute --- this sql script. --- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql' +# On unix, you should use the mysql_fix_privilege_tables script to execute +# this sql script. +# On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql' set storage_engine=MyISAM; -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) -) CHARACTER SET utf8 COLLATE utf8_bin; - ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; --- Detect whether or not we had the Grant_priv column +# Detect whether or not we had the Grant_priv column SET @hadGrantPriv:=0; SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%'; @@ -29,14 +21,14 @@ ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,a 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; 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; --- Fix privileges for old tables +# Fix privileges for old tables UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; --- --- The second alter changes ssl_type to new 4.0.2 format --- Adding columns needed by GRANT .. REQUIRE (openssl)" +# +# The second alter changes ssl_type to new 4.0.2 format +# Adding columns needed by GRANT .. REQUIRE (openssl)" ALTER TABLE user ADD ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci NOT NULL, @@ -45,23 +37,9 @@ ADD x509_issuer BLOB NOT NULL, ADD x509_subject BLOB NOT NULL; ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL; --- --- tables_priv --- -CREATE TABLE IF NOT EXISTS tables_priv ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) binary DEFAULT '' NOT NULL, - Table_name char(64) binary DEFAULT '' NOT NULL, - Grantor char(77) DEFAULT '' NOT NULL, - Timestamp timestamp(14), - Table_priv set('Select','Insert','Update','Delete','Create', - 'Drop','Grant','References','Index','Alter') - 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) -) CHARACTER SET utf8 COLLATE utf8_bin; +# +# tables_priv +# ALTER TABLE tables_priv ADD KEY Grantor (Grantor); @@ -84,21 +62,11 @@ ALTER TABLE tables_priv COLLATE utf8_general_ci DEFAULT '' NOT NULL, COMMENT='Table privileges'; --- --- columns_priv --- -CREATE TABLE IF NOT EXISTS columns_priv ( - Host char(60) DEFAULT '' NOT NULL, - Db char(64) DEFAULT '' NOT NULL, - User char(16) DEFAULT '' NOT NULL, - Table_name char(64) DEFAULT '' NOT NULL, - Column_name char(64) DEFAULT '' NOT NULL, - Timestamp timestamp(14), - Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, - PRIMARY KEY (Host,Db,User,Table_name,Column_name) -) CHARACTER SET utf8 COLLATE utf8_bin; - --- Name change of Type -> Column_priv from MySQL 3.22.12 +# +# columns_priv +# + +# Name change of Type -> Column_priv from MySQL 3.22.12 ALTER TABLE columns_priv CHANGE Type Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; @@ -117,15 +85,15 @@ ALTER TABLE columns_priv MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; --- --- Add the new 'type' column to the func table. --- +# +# Add the new 'type' column to the func table. +# ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL; --- --- Change the user,db and host tables to current format --- +# +# Change the user,db and host tables to current format +# # Detect whether we had Show_db_priv SET @hadShowDbPriv:=0; @@ -140,13 +108,13 @@ ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTE ADD Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Execute_priv, ADD Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; --- Convert privileges so that users have similar privileges as before +# Convert privileges so that users have similar privileges as before 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; --- Add fields that can be used to limit number of questions and connections --- for some users. +# Add fields that can be used to limit number of questions and connections +# for some users. ALTER TABLE user ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject, @@ -154,9 +122,9 @@ ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions, ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates; --- --- Add Create_tmp_table_priv and Lock_tables_priv to db and host --- +# +# Add Create_tmp_table_priv and Lock_tables_priv to db and host +# ALTER TABLE db ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, @@ -173,8 +141,8 @@ alter table host comment='Host privileges; Merged with database privileges'; alter table user comment='Users and global privileges'; alter table func comment='User defined functions'; --- Convert all tables to UTF-8 with binary collation --- and reset all char columns to correct width +# Convert all tables to UTF-8 with binary collation +# and reset all char columns to correct width ALTER TABLE user MODIFY Host char(60) NOT NULL default '', MODIFY User char(16) NOT NULL default '', @@ -248,7 +216,7 @@ ALTER TABLE func # # Detect whether we had Create_view_priv -# +# SET @hadCreateViewPriv:=0; SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%'; @@ -325,7 +293,7 @@ UPDATE db SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Ex UPDATE host SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Execute_priv=Select_priv where @hadCreateRoutinePriv = 0; # -# Add max_user_connections resource limit +# Add max_user_connections resource limit # ALTER TABLE user ADD max_user_connections int(11) unsigned DEFAULT '0' NOT NULL AFTER max_connections; @@ -342,22 +310,9 @@ UPDATE user LEFT JOIN db USING (Host,User) SET Create_user_priv='Y' WHERE @hadCreateUserPriv = 0 AND (user.Grant_priv = 'Y' OR db.Grant_priv = 'Y'); --- --- procs_priv --- -CREATE TABLE IF NOT EXISTS procs_priv ( - Host char(60) binary DEFAULT '' NOT NULL, - Db char(64) binary DEFAULT '' NOT NULL, - User char(16) binary DEFAULT '' NOT NULL, - Routine_name char(64) binary DEFAULT '' NOT NULL, - Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, - Grantor char(77) DEFAULT '' NOT NULL, - Proc_priv set('Execute','Alter Routine','Grant') - COLLATE utf8_general_ci DEFAULT '' NOT NULL, - Timestamp timestamp(14), - PRIMARY KEY (Host, Db, User, Routine_name, Routine_type), - KEY Grantor (Grantor) -) CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; +# +# procs_priv +# ALTER TABLE procs_priv ENGINE=MyISAM, @@ -374,143 +329,9 @@ ALTER TABLE procs_priv ALTER TABLE procs_priv MODIFY Timestamp timestamp(14) AFTER Proc_priv; --- --- help_topic --- -CREATE TABLE IF NOT EXISTS help_topic ( -help_topic_id int unsigned not null, -name varchar(64) not null, -help_category_id smallint unsigned not null, -description text not null, -example text not null, -url varchar(128) not null, -primary key (help_topic_id), unique index (name) -) CHARACTER SET utf8 comment='help topics'; - -CREATE TABLE IF NOT EXISTS help_category ( -help_category_id smallint unsigned not null, -name varchar(64) not null, -parent_category_id smallint unsigned null, -url varchar(128) not null, -primary key (help_category_id), -unique index (name) -) CHARACTER SET utf8 comment='help categories'; - -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) -) CHARACTER SET utf8 comment='keyword-topic relation'; - -CREATE TABLE IF NOT EXISTS help_keyword ( -help_keyword_id int unsigned not null, -name varchar(64) not null, -primary key (help_keyword_id), -unique index (name) -) CHARACTER SET utf8 comment='help keywords'; - -# -# Create missing time zone related tables -# - -CREATE TABLE IF NOT EXISTS time_zone_name ( -Name char(64) NOT NULL, -Time_zone_id int unsigned NOT NULL, -PRIMARY KEY Name (Name) -) CHARACTER SET utf8 comment='Time zone names'; - -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) -) CHARACTER SET utf8 comment='Time zones'; --- Make enum field case-insensitive -ALTER TABLE time_zone - MODIFY Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; - -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) -) CHARACTER SET utf8 comment='Time zone transitions'; - -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) -) CHARACTER SET utf8 comment='Time zone transition types'; - -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) -) CHARACTER SET utf8 comment='Leap seconds information for time zones'; - - -# -# Create proc table if it does not exists -# - -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') 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 DEFAULT '' NOT NULL, - returns char(64) DEFAULT '' NOT NULL, - body longblob DEFAULT '' NOT NULL, - definer char(77) collate utf8_bin DEFAULT '' NOT NULL, - created timestamp, - modified timestamp, - sql_mode set( - 'REAL_AS_FLOAT', - 'PIPES_AS_CONCAT', - 'ANSI_QUOTES', - 'IGNORE_SPACE', - 'NOT_USED', - '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' - ) DEFAULT '' NOT NULL, - comment char(64) collate utf8_bin DEFAULT '' NOT NULL, - PRIMARY KEY (db,name,type) -) engine=MyISAM - character set utf8 - comment='Stored Procedures'; +# +# proc +# # Correct the name fields to not binary, and expand sql_data_access ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL, diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 0e89a32aa66..ed5c8c97d6b 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -14,8 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# This scripts creates the privilege tables db, host, user, tables_priv, -# columns_priv, procs_priv in the mysql database, as well as the func table. +# This scripts creates the MySQL Server system tables # # All unrecognized arguments to this script are passed to mysqld. @@ -30,6 +29,14 @@ case "$1" in ;; esac +s_echo() +{ + if test "$in_rpm" -eq 0 -a "$windows" -eq 0 + then + echo $1 + fi +} + parse_arguments() { # We only need to pass arguments through to the server if we don't # handle them here. So, we collect unrecognized options (passed on @@ -53,9 +60,20 @@ parse_arguments() { # where a chown of datadir won't help) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --skip-name-resolve) ip_only=1 ;; - --verbose) verbose=1 ;; + --verbose) verbose=1 ;; # Obsolete --rpm) in_rpm=1 ;; - --windows) windows=1 ;; + + --windows) + # This is actually a "cross bootstrap" argument used when + # building the MySQL system tables on a different host + # than the target. The platform independent + # files that are created in --datadir on the host can + # be copied to the target system, the most common use for + # this feature is in the windows installer which will take + # the files from datadir and include them as part of the install + # package. + windows=1 ;; + *) if test -n "$pick_args" then @@ -93,8 +111,6 @@ bindir= basedir= srcdir= force=0 -verbose=0 -fill_help_tables="" parse_arguments `$print_defaults $defaults mysqld mysql_install_db` parse_arguments PICK-ARGS-FROM-ARGV "$@" @@ -119,29 +135,42 @@ else fi fi -# find fill_help_tables.sh +# Find SQL scripts needed for bootstrap +fill_help_tables="fill_help_tables.sql" +create_system_tables="mysql_system_tables.sql" if test -n "$srcdir" then - fill_help_tables=$srcdir/scripts/fill_help_tables.sql + fill_help_tables=$srcdir/scripts/$fill_help_tables + create_system_tables=$srcdir/scripts/$create_system_tables else for i in $basedir/support-files $basedir/share $basedir/share/mysql \ $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ do - if test -f $i/fill_help_tables.sql + if test -f $i/$fill_help_tables then pkgdatadir=$i fi done - fill_help_tables=$pkgdatadir/fill_help_tables.sql + fill_help_tables=$pkgdatadir/$fill_help_tables + create_system_tables=$pkgdatadir/$create_system_tables +fi + +if test ! -f $create_system_tables +then + echo "FATAL ERROR: Could not find SQL file '$create_system_tables' in" + echo "@pkgdatadir@ or inside $basedir" + exit 1; fi if test ! -f $fill_help_tables then - echo "Could not find help file 'fill_help_tables.sql' in @pkgdatadir@ or inside $basedir". + echo "FATAL ERROR: Could not find help file '$fill_help_tables' in" + echo "@pkgdatadir@ or inside $basedir" exit 1; fi +# Find executables and paths mdata=$ldata/mysql mysqld=$execdir/mysqld mysqld_opt="" @@ -167,7 +196,7 @@ then echo "FATAL ERROR $mysqld not found!" exit 1 else - echo "Didn't find $mysqld" + echo "FATAL ERROR Didn't find $mysqld" echo "You should do a 'make install' before executing this script" exit 1 fi @@ -187,9 +216,10 @@ then then echo "Neither host '$hostname' nor 'localhost' could be looked up with" echo "$bindir/resolveip" - echo "Please configure the 'hostname' command to return a correct hostname." - echo "If you want to solve this at a later stage, restart this script with" - echo "the --force option" + echo "Please configure the 'hostname' command to return a correct" + echo "hostname." + echo "If you want to solve this at a later stage, restart this script" + echo "with the --force option" exit 1 fi echo "WARNING: The host '$hostname' could not be looked up with resolveip." @@ -208,104 +238,113 @@ then fi # Create database directories mysql & test - - if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi - if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi - if test ! -d $ldata/test; then mkdir $ldata/test; chmod 700 $ldata/test ; fi - if test -w / -a ! -z "$user"; then - chown $user $ldata $ldata/mysql $ldata/test; - fi - -if test ! -f $mdata/db.frm -then - c_d="yes" +if test ! -d $ldata; then + mkdir $ldata; + chmod 700 $ldata ; +fi +if test ! -d $ldata/mysql; then + mkdir $ldata/mysql; + chmod 700 $ldata/mysql ; +fi +if test ! -d $ldata/test; then + mkdir $ldata/test; + chmod 700 $ldata/test ; +fi +if test -w / -a ! -z "$user"; then + chown $user $ldata $ldata/mysql $ldata/test; fi -if test $verbose = 1 +# Check is "db" table already exist +if test ! -f $mdata/db.frm then - create_option="verbose" -else - create_option="real" + db_table_already_exist="yes" fi if test -n "$user"; then args="$args --user=$user" fi -if test "$in_rpm" -eq 0 -a "$windows" -eq 0 -then - echo "Installing all prepared tables" -fi +# Peform the install of system tables mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ ---skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ ---skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" -if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ - | eval "$mysqld_install_cmd_line" +--basedir=$basedir --datadir=$ldata --skip-innodb \ +--skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M \ +--net_buffer_length=16K" + +# Pipe mysql_system_tables.sql to "mysqld --bootstrap" +s_echo "Installing MySQL system tables..." +if `(echo "use mysql;"; cat $create_system_tables) | $mysqld_install_cmd_line` then + s_echo "OK" + if test -n "$fill_help_tables" then - if test "$in_rpm" -eq 0 -a "$windows" -eq 0 - then - echo "Fill help tables" - fi - (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line" - res=$? - if test $res != 0 + s_echo "Filling help tables..." + # Pipe fill_help_tables.sql to "mysqld --bootstrap" + if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line` then + # Fill suceeded + s_echo "OK" + else echo "" echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" echo "The \"HELP\" command might not work properly" echo "" fi fi - if test "$in_rpm" = 0 -a "$windows" = 0 - then - echo "" - echo "To start mysqld at boot time you have to copy support-files/mysql.server" - echo "to the right place for your system" - echo - fi + + s_echo "" + s_echo "To start mysqld at boot time you have to copy" + s_echo "support-files/mysql.server to the right place for your system" + s_echo + if test "$windows" -eq 0 then - echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" - echo "To do so, start the server, then issue the following commands:" - echo "$bindir/mysqladmin -u root password 'new-password'" - echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" - echo "See the manual for more instructions." - # - # Print message about upgrading unless we have created a new db table. - if test -z "$c_d" - then - echo - echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" - echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" - echo "able to use the new GRANT command!" - fi - echo - if test "$in_rpm" = "0" - then - echo "You can start the MySQL daemon with:" - echo "cd @prefix@ ; $bindir/mysqld_safe &" + # A root password should of course also be set on Windows! + # The reason for not displaying these prompts here is that when + # executing this script with the --windows argument the script + # is used to generate system tables mainly used by the + # windows installer. And thus the password should not be set until + # those files has been copied to the target system + echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !" + echo "To do so, start the server, then issue the following commands:" + echo "$bindir/mysqladmin -u root password 'new-password'" + echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" + echo "See the manual for more instructions." + + # Print message about upgrading unless we have created a new db table. + if test -z "$db_table_already_exist" + then + echo + echo "NOTE: If you are upgrading from a previous MySQL verision you " + echo "should run '$bindir/mysql_upgrade', to make sure all tables have " + echo "been upgraded for this version of MySQL" + fi echo - echo "You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:" - echo "cd sql-bench ; perl run-all-tests" + + if test "$in_rpm" = "0" + then + echo "You can start the MySQL daemon with:" + echo "cd @prefix@ ; $bindir/mysqld_safe &" + echo + echo "You can test the MySQL daemon with mysql-test-run.pl" + echo "cd mysql-test ; perl mysql-test-run.pl" + echo + fi + echo "Please report any problems with the @scriptdir@/mysqlbug script!" echo - fi - echo "Please report any problems with the @scriptdir@/mysqlbug script!" - echo - echo "The latest information about MySQL is available on the web at" - echo "http://www.mysql.com" - echo "Support MySQL by buying support/licenses at http://shop.mysql.com" + echo "The latest information about MySQL is available on the web at" + echo "http://www.mysql.com" + echo "Support MySQL by buying support/licenses at http://shop.mysql.com" fi exit 0 else echo "Installation of system tables failed!" echo echo "Examine the logs in $ldata for more information." - echo "You can also try to start the mysqld daemon with:" + echo "You can try to start the mysqld daemon with:" echo "$mysqld --skip-grant &" - echo "You can use the command line tool" + echo "and use the command line tool" echo "$bindir/mysql to connect to the mysql" echo "database and look at the grant tables:" echo diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql new file mode 100644 index 00000000000..7b4e0ee877d --- /dev/null +++ b/scripts/mysql_system_tables.sql @@ -0,0 +1,65 @@ +-- +-- The system tables of MySQL Server +-- + +set storage_engine=myisam; + +CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) 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, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; + +-- default grants for anyone to access database 'test' and 'test_%' +INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO db VALUES ('%','test_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); + + +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, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; + + +CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) 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, 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) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; + + +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'; + + +CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') 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'; + +CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), 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'; + + +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 char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics'; + + +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 char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories'; + + +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'; + + +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'; + + +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'; + + +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'; + + +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'; + + +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'; + + +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'; + + +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') 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 DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', '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' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures'; + + +CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; + +-- default users allowing root access from local machine +INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO user VALUES (@@hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); + + diff --git a/scripts/mysql_test_data_timezone.sql b/scripts/mysql_test_data_timezone.sql new file mode 100644 index 00000000000..e52df2149f2 --- /dev/null +++ b/scripts/mysql_test_data_timezone.sql @@ -0,0 +1,5 @@ +INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); +INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); +INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1) ,(1, -1663455600, 2) ,(1, -1650150000, 3) ,(1, -1632006000, 2) ,(1, -1618700400, 3) ,(1, -938905200, 2) ,(1, -857257200, 3) ,(1, -844556400, 2) ,(1, -828226800, 3) ,(1, -812502000, 2) ,(1, -796777200, 3) ,(1, 228877200, 2) ,(1, 243997200, 3) ,(1, 260326800, 2) ,(1, 276051600, 3) ,(1, 291776400, 2) ,(1, 307501200, 3) ,(1, 323830800, 2) ,(1, 338950800, 3) ,(1, 354675600, 2) ,(1, 370400400, 3) ,(1, 386125200, 2) ,(1, 401850000, 3) ,(1, 417574800, 2) ,(1, 433299600, 3) ,(1, 449024400, 2) ,(1, 465354000, 3) ,(1, 481078800, 2) ,(1, 496803600, 3) ,(1, 512528400, 2) ,(1, 528253200, 3) ,(1, 543978000, 2) ,(1, 559702800, 3) ,(1, 575427600, 2) ,(1, 591152400, 3) ,(1, 606877200, 2) ,(1, 622602000, 3) ,(1, 638326800, 2) ,(1, 654656400, 3) ,(1, 670381200, 2) ,(1, 686106000, 3) ,(1, 701830800, 2) ,(1, 717555600, 3) ,(1, 733280400, 2) ,(1, 749005200, 3) ,(1, 764730000, 2) ,(1, 780454800, 3) ,(1, 796179600, 2) ,(1, 811904400, 3) ,(1, 828234000, 2) ,(1, 846378000, 3) ,(1, 859683600, 2) ,(1, 877827600, 3) ,(1, 891133200, 2) ,(1, 909277200, 3) ,(1, 922582800, 2) ,(1, 941331600, 3) ,(1, 954032400, 2) ,(1, 972781200, 3) ,(1, 985482000, 2) ,(1, 1004230800, 3) ,(1, 1017536400, 2) ,(1, 1035680400, 3) ,(1, 1048986000, 2) ,(1, 1067130000, 3) ,(1, 1080435600, 2) ,(1, 1099184400, 3) ,(1, 1111885200, 2) ,(1, 1130634000, 3) ,(1, 1143334800, 2) ,(1, 1162083600, 3) ,(1, 1174784400, 2) ,(1, 1193533200, 3) ,(1, 1206838800, 2) ,(1, 1224982800, 3) ,(1, 1238288400, 2) ,(1, 1256432400, 3) ,(1, 1269738000, 2) ,(1, 1288486800, 3) ,(1, 1301187600, 2) ,(1, 1319936400, 3) ,(1, 1332637200, 2) ,(1, 1351386000, 3) ,(1, 1364691600, 2) ,(1, 1382835600, 3) ,(1, 1396141200, 2) ,(1, 1414285200, 3) ,(1, 1427590800, 2) ,(1, 1445734800, 3) ,(1, 1459040400, 2) ,(1, 1477789200, 3) ,(1, 1490490000, 2) ,(1, 1509238800, 3) ,(1, 1521939600, 2) ,(1, 1540688400, 3) ,(1, 1553994000, 2) ,(1, 1572138000, 3) ,(1, 1585443600, 2) ,(1, 1603587600, 3) ,(1, 1616893200, 2) ,(1, 1635642000, 3) ,(1, 1648342800, 2) ,(1, 1667091600, 3) ,(1, 1679792400, 2) ,(1, 1698541200, 3) ,(1, 1711846800, 2) ,(1, 1729990800, 3) ,(1, 1743296400, 2) ,(1, 1761440400, 3) ,(1, 1774746000, 2) ,(1, 1792890000, 3) ,(1, 1806195600, 2) ,(1, 1824944400, 3) ,(1, 1837645200, 2) ,(1, 1856394000, 3) ,(1, 1869094800, 2) ,(1, 1887843600, 3) ,(1, 1901149200, 2) ,(1, 1919293200, 3) ,(1, 1932598800, 2) ,(1, 1950742800, 3) ,(1, 1964048400, 2) ,(1, 1982797200, 3) ,(1, 1995498000, 2) ,(1, 2014246800, 3) ,(1, 2026947600, 2) ,(1, 2045696400, 3) ,(1, 2058397200, 2) ,(1, 2077146000, 3) ,(1, 2090451600, 2) ,(1, 2108595600, 3) ,(1, 2121901200, 2) ,(1, 2140045200, 3) ,(3, -1688265000, 2) ,(3, -1656819048, 1) ,(3, -1641353448, 2) ,(3, -1627965048, 3) ,(3, -1618716648, 1) ,(3, -1596429048, 3) ,(3, -1593829848, 5) ,(3, -1589860800, 4) ,(3, -1542427200, 5) ,(3, -1539493200, 6) ,(3, -1525323600, 5) ,(3, -1522728000, 4) ,(3, -1491188400, 7) ,(3, -1247536800, 4) ,(3, 354920400, 5) ,(3, 370728000, 4) ,(3, 386456400, 5) ,(3, 402264000, 4) ,(3, 417992400, 5) ,(3, 433800000, 4) ,(3, 449614800, 5) ,(3, 465346800, 8) ,(3, 481071600, 9) ,(3, 496796400, 8) ,(3, 512521200, 9) ,(3, 528246000, 8) ,(3, 543970800, 9) ,(3, 559695600, 8) ,(3, 575420400, 9) ,(3, 591145200, 8) ,(3, 606870000, 9) ,(3, 622594800, 8) ,(3, 638319600, 9) ,(3, 654649200, 8) ,(3, 670374000, 10) ,(3, 686102400, 11) ,(3, 695779200, 8) ,(3, 701812800, 5) ,(3, 717534000, 4) ,(3, 733273200, 9) ,(3, 748998000, 8) ,(3, 764722800, 9) ,(3, 780447600, 8) ,(3, 796172400, 9) ,(3, 811897200, 8) ,(3, 828226800, 9) ,(3, 846370800, 8) ,(3, 859676400, 9) ,(3, 877820400, 8) ,(3, 891126000, 9) ,(3, 909270000, 8) ,(3, 922575600, 9) ,(3, 941324400, 8) ,(3, 954025200, 9) ,(3, 972774000, 8) ,(3, 985474800, 9) ,(3, 1004223600, 8) ,(3, 1017529200, 9) ,(3, 1035673200, 8) ,(3, 1048978800, 9) ,(3, 1067122800, 8) ,(3, 1080428400, 9) ,(3, 1099177200, 8) ,(3, 1111878000, 9) ,(3, 1130626800, 8) ,(3, 1143327600, 9) ,(3, 1162076400, 8) ,(3, 1174777200, 9) ,(3, 1193526000, 8) ,(3, 1206831600, 9) ,(3, 1224975600, 8) ,(3, 1238281200, 9) ,(3, 1256425200, 8) ,(3, 1269730800, 9) ,(3, 1288479600, 8) ,(3, 1301180400, 9) ,(3, 1319929200, 8) ,(3, 1332630000, 9) ,(3, 1351378800, 8) ,(3, 1364684400, 9) ,(3, 1382828400, 8) ,(3, 1396134000, 9) ,(3, 1414278000, 8) ,(3, 1427583600, 9) ,(3, 1445727600, 8) ,(3, 1459033200, 9) ,(3, 1477782000, 8) ,(3, 1490482800, 9) ,(3, 1509231600, 8) ,(3, 1521932400, 9) ,(3, 1540681200, 8) ,(3, 1553986800, 9) ,(3, 1572130800, 8) ,(3, 1585436400, 9) ,(3, 1603580400, 8) ,(3, 1616886000, 9) ,(3, 1635634800, 8) ,(3, 1648335600, 9) ,(3, 1667084400, 8) ,(3, 1679785200, 9) ,(3, 1698534000, 8) ,(3, 1711839600, 9) ,(3, 1729983600, 8) ,(3, 1743289200, 9) ,(3, 1761433200, 8) ,(3, 1774738800, 9) ,(3, 1792882800, 8) ,(3, 1806188400, 9) ,(3, 1824937200, 8) ,(3, 1837638000, 9) ,(3, 1856386800, 8) ,(3, 1869087600, 9) ,(3, 1887836400, 8) ,(3, 1901142000, 9) ,(3, 1919286000, 8) ,(3, 1932591600, 9) ,(3, 1950735600, 8) ,(3, 1964041200, 9) ,(3, 1982790000, 8) ,(3, 1995490800, 9) ,(3, 2014239600, 8) ,(3, 2026940400, 9) ,(3, 2045689200, 8) ,(3, 2058390000, 9) ,(3, 2077138800, 8) ,(3, 2090444400, 9) ,(3, 2108588400, 8) ,(3, 2121894000, 9) ,(3, 2140038000, 8) ,(4, -1688265000, 2) ,(4, -1656819048, 1) ,(4, -1641353448, 2) ,(4, -1627965048, 3) ,(4, -1618716648, 1) ,(4, -1596429048, 3) ,(4, -1593829848, 5) ,(4, -1589860800, 4) ,(4, -1542427200, 5) ,(4, -1539493200, 6) ,(4, -1525323600, 5) ,(4, -1522728000, 4) ,(4, -1491188400, 7) ,(4, -1247536800, 4) ,(4, 354920409, 5) ,(4, 370728010, 4) ,(4, 386456410, 5) ,(4, 402264011, 4) ,(4, 417992411, 5) ,(4, 433800012, 4) ,(4, 449614812, 5) ,(4, 465346812, 8) ,(4, 481071612, 9) ,(4, 496796413, 8) ,(4, 512521213, 9) ,(4, 528246013, 8) ,(4, 543970813, 9) ,(4, 559695613, 8) ,(4, 575420414, 9) ,(4, 591145214, 8) ,(4, 606870014, 9) ,(4, 622594814, 8) ,(4, 638319615, 9) ,(4, 654649215, 8) ,(4, 670374016, 10) ,(4, 686102416, 11) ,(4, 695779216, 8) ,(4, 701812816, 5) ,(4, 717534017, 4) ,(4, 733273217, 9) ,(4, 748998018, 8) ,(4, 764722818, 9) ,(4, 780447619, 8) ,(4, 796172419, 9) ,(4, 811897219, 8) ,(4, 828226820, 9) ,(4, 846370820, 8) ,(4, 859676420, 9) ,(4, 877820421, 8) ,(4, 891126021, 9) ,(4, 909270021, 8) ,(4, 922575622, 9) ,(4, 941324422, 8) ,(4, 954025222, 9) ,(4, 972774022, 8) ,(4, 985474822, 9) ,(4, 1004223622, 8) ,(4, 1017529222, 9) ,(4, 1035673222, 8) ,(4, 1048978822, 9) ,(4, 1067122822, 8) ,(4, 1080428422, 9) ,(4, 1099177222, 8) ,(4, 1111878022, 9) ,(4, 1130626822, 8) ,(4, 1143327622, 9) ,(4, 1162076422, 8) ,(4, 1174777222, 9) ,(4, 1193526022, 8) ,(4, 1206831622, 9) ,(4, 1224975622, 8) ,(4, 1238281222, 9) ,(4, 1256425222, 8) ,(4, 1269730822, 9) ,(4, 1288479622, 8) ,(4, 1301180422, 9) ,(4, 1319929222, 8) ,(4, 1332630022, 9) ,(4, 1351378822, 8) ,(4, 1364684422, 9) ,(4, 1382828422, 8) ,(4, 1396134022, 9) ,(4, 1414278022, 8) ,(4, 1427583622, 9) ,(4, 1445727622, 8) ,(4, 1459033222, 9) ,(4, 1477782022, 8) ,(4, 1490482822, 9) ,(4, 1509231622, 8) ,(4, 1521932422, 9) ,(4, 1540681222, 8) ,(4, 1553986822, 9) ,(4, 1572130822, 8) ,(4, 1585436422, 9) ,(4, 1603580422, 8) ,(4, 1616886022, 9) ,(4, 1635634822, 8) ,(4, 1648335622, 9) ,(4, 1667084422, 8) ,(4, 1679785222, 9) ,(4, 1698534022, 8) ,(4, 1711839622, 9) ,(4, 1729983622, 8) ,(4, 1743289222, 9) ,(4, 1761433222, 8) ,(4, 1774738822, 9) ,(4, 1792882822, 8) ,(4, 1806188422, 9) ,(4, 1824937222, 8) ,(4, 1837638022, 9) ,(4, 1856386822, 8) ,(4, 1869087622, 9) ,(4, 1887836422, 8) ,(4, 1901142022, 9) ,(4, 1919286022, 8) ,(4, 1932591622, 9) ,(4, 1950735622, 8) ,(4, 1964041222, 9) ,(4, 1982790022, 8) ,(4, 1995490822, 9) ,(4, 2014239622, 8) ,(4, 2026940422, 9) ,(4, 2045689222, 8) ,(4, 2058390022, 9) ,(4, 2077138822, 8) ,(4, 2090444422, 9) ,(4, 2108588422, 8) ,(4, 2121894022, 9) ,(4, 2140038022, 8) ,(5, -1009875600, 1); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); +INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22); |