Commit ec7a698a authored by unknown's avatar unknown

Merge pilot.blaudden:/home/msvensson/mysql/bug20166/my51-bug20166

into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-new-maint


mysql-test/t/rpl_temporary.test:
  Auto merged
sql/mysqld.cc:
  Auto merged
parents 4131465e b74f45ac
...@@ -1813,6 +1813,7 @@ scripts/mysql_explain_log ...@@ -1813,6 +1813,7 @@ scripts/mysql_explain_log
scripts/mysql_find_rows scripts/mysql_find_rows
scripts/mysql_fix_extensions scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_install_db scripts/mysql_install_db
scripts/mysql_secure_installation scripts/mysql_secure_installation
scripts/mysql_setpermission scripts/mysql_setpermission
......
...@@ -70,7 +70,6 @@ dist-hook: ...@@ -70,7 +70,6 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
install-data-local: install-data-local:
...@@ -112,7 +111,6 @@ install-data-local: ...@@ -112,7 +111,6 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51 $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
uninstall-local: uninstall-local:
......
# 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;
# 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;
This diff is collapsed.
...@@ -300,6 +300,8 @@ our $path_ndb_examples_dir; ...@@ -300,6 +300,8 @@ our $path_ndb_examples_dir;
our $exe_ndb_example; our $exe_ndb_example;
our $path_ndb_testrun_log; our $path_ndb_testrun_log;
our $path_sql_dir;
our @data_dir_lst; our @data_dir_lst;
our $used_binlog_format; our $used_binlog_format;
...@@ -1498,12 +1500,16 @@ sub executable_setup () { ...@@ -1498,12 +1500,16 @@ sub executable_setup () {
$exe_mysql_fix_system_tables= $exe_mysql_fix_system_tables=
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables", mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"$path_client_bindir/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 # Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables= $file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql", mtr_file_exists("$path_sql_dir/mysql_fix_privilege_tables.sql");
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
{ {
...@@ -1954,6 +1960,7 @@ sub environment_setup () { ...@@ -1954,6 +1960,7 @@ sub environment_setup () {
"--port=$master->[0]->{'port'} " . "--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}"; "--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
} }
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
...@@ -2871,42 +2878,13 @@ sub install_db ($$) { ...@@ -2871,42 +2878,13 @@ sub install_db ($$) {
my $type= shift; my $type= shift;
my $data_dir= 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"); 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_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--bootstrap"); mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--console");
mtr_add_arg($args, "--skip-grant-tables");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir); mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir); mtr_add_arg($args, "--datadir=%s", $data_dir);
mtr_add_arg($args, "--skip-innodb"); mtr_add_arg($args, "--skip-innodb");
...@@ -2933,21 +2911,49 @@ sub install_db ($$) { ...@@ -2933,21 +2911,49 @@ sub install_db ($$) {
# --bootstrap, to accommodate this. # --bootstrap, to accommodate this.
my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld; my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
$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 # Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log, mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); "$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, $path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 ) "", { append_log_file => 1 }) != 0 )
{ {
unlink($init_db_sql_tmp);
mtr_error("Error executing mysqld --bootstrap\n" . 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);
} }
......
drop table if exists t1;
drop table t1;
drop table t1;
ERROR 42S02: Unknown table 't1'
set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
...@@ -522,9 +522,11 @@ drop database mysqltest; ...@@ -522,9 +522,11 @@ drop database mysqltest;
select database(); select database();
database() database()
NULL NULL
create user mysqltest_1;
select database(), user(); select database(), user();
database() user() database() user()
NULL mysqltest_1@localhost NULL mysqltest_1@localhost
drop user mysqltest_1;
use test; use test;
create table t1 (a int, index `primary` (a)); create table t1 (a int, index `primary` (a));
ERROR 42000: Incorrect index name 'primary' ERROR 42000: Incorrect index name 'primary'
......
...@@ -202,6 +202,7 @@ drop table t1,t2; ...@@ -202,6 +202,7 @@ drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x x
1 1
create user mysqltest_1;
create table t1 select 1 as a; create table t1 select 1 as a;
select 2 as a from (select * from t1) b; select 2 as a from (select * from t1) b;
ERROR 3D000: No database selected ERROR 3D000: No database selected
...@@ -380,3 +381,4 @@ ID DATA FID ...@@ -380,3 +381,4 @@ ID DATA FID
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;
ID DATA FID ID DATA FID
drop table t1, t2; drop table t1, t2;
drop user mysqltest_1;
...@@ -701,7 +701,7 @@ select * from information_schema.statistics join information_schema.columns ...@@ -701,7 +701,7 @@ select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user'; 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 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 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 t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
......
...@@ -45,7 +45,7 @@ db1_secret ...@@ -45,7 +45,7 @@ db1_secret
select * from db1_secret.t1; select * from db1_secret.t1;
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1' ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end; 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; drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist ERROR 42000: PROCEDURE db1_secret.dummy does not exist
select * from t1; select * from t1;
...@@ -76,9 +76,9 @@ ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' ...@@ -76,9 +76,9 @@ ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
select db1_secret.db(); select db1_secret.db();
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
call db1_secret.stamp(6); 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(); 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; drop database if exists db2;
create database db2; create database db2;
use db2; use db2;
......
...@@ -903,6 +903,14 @@ select @@&; ...@@ -903,6 +903,14 @@ select @@&;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&' at line 1
select @@@; select @@@;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@' at line 1
select @@hostname;
@@hostname
#
set @@hostname= "anothername";
ERROR HY000: Variable 'hostname' is a read only variable
show variables like 'hostname';
Variable_name Value
hostname #
End of 5.0 tests End of 5.0 tests
set global binlog_cache_size =@my_binlog_cache_size; set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout; set global connect_timeout =@my_connect_timeout;
......
#
# test mysqld in bootstrap mode
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Check that --bootstrap reads from stdin
#
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap.sql
use test;
CREATE TABLE t1(a int);
EOF
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
drop table t1;
#
# Check that --bootstrap of file with SQL error returns error
#
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
use test;
CREATE TABLE t1;
EOF
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
# Table t1 should not exists
--error 1051
drop table t1;
#
# Bootstrap with a query larger than 2*thd->net.max_packet
#
set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
--disable_query_log
create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
--enable_query_log
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
...@@ -410,12 +410,14 @@ select database(); ...@@ -410,12 +410,14 @@ select database();
drop database mysqltest; drop database mysqltest;
select database(); 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*); connect (user1,localhost,mysqltest_1,,*NO-ONE*);
connection user1; connection user1;
select database(), user(); select database(), user();
connection default; connection default;
disconnect user1; disconnect user1;
drop user mysqltest_1;
use test; use test;
# #
......
...@@ -99,7 +99,8 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; ...@@ -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. # 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; create table t1 select 1 as a;
connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection con1; connection con1;
...@@ -271,4 +272,8 @@ select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID); ...@@ -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; select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
drop table t1, t2; drop table t1, t2;
disconnect con1;
connection default;
drop user mysqltest_1;
# End of 4.1 tests # End of 4.1 tests
...@@ -395,6 +395,8 @@ delete from mysql.user where user like 'mysqltest\_1'; ...@@ -395,6 +395,8 @@ delete from mysql.user where user like 'mysqltest\_1';
flush privileges; flush privileges;
drop database mysqltest_1; drop database mysqltest_1;
--source include/add_anonymous_users.inc
# But anonymous users can't change their password # But anonymous users can't change their password
connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n5; connection n5;
...@@ -403,6 +405,8 @@ set password = password("changed"); ...@@ -403,6 +405,8 @@ set password = password("changed");
disconnect n5; disconnect n5;
connection default; connection default;
--source include/delete_anonymous_users.inc
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in # Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# multi-threaded environment". We should be able to execute FLUSH # multi-threaded environment". We should be able to execute FLUSH
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_query_cache.inc -- source include/have_query_cache.inc
--source include/add_anonymous_users.inc
# #
# Test grants with query cache # Test grants with query cache
# #
...@@ -71,6 +73,7 @@ show status like "Qcache_queries_in_cache"; ...@@ -71,6 +73,7 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_hits"; show status like "Qcache_hits";
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
# Don't use '' as user because it will pick Unix login # Don't use '' as user because it will pick Unix login
connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK); connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK);
connection unkuser; connection unkuser;
...@@ -150,4 +153,7 @@ drop database mysqltest; ...@@ -150,4 +153,7 @@ drop database mysqltest;
set GLOBAL query_cache_size=default; set GLOBAL query_cache_size=default;
--source include/delete_anonymous_users.inc
# End of 4.1 tests # End of 4.1 tests
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Test of init_connect variable # Test of init_connect variable
# #
--source include/add_anonymous_users.inc
# should work with embedded server after mysqltest is fixed # should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc -- source include/not_embedded.inc
connect (con0,localhost,root,,); connect (con0,localhost,root,,);
...@@ -41,6 +43,8 @@ disconnect con3; ...@@ -41,6 +43,8 @@ disconnect con3;
disconnect con4; disconnect con4;
disconnect con5; disconnect con5;
--source include/delete_anonymous_users.inc
--echo End of 4.1 tests --echo End of 4.1 tests
# #
# Test 5.* features # Test 5.* features
......
...@@ -123,6 +123,10 @@ drop table t1; ...@@ -123,6 +123,10 @@ drop table t1;
# #
# Bug#16986 - Deadlock condition with MyISAM tables # 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; connection locker;
use mysql; use mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE; LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
...@@ -199,6 +203,8 @@ UNLOCK TABLES; ...@@ -199,6 +203,8 @@ UNLOCK TABLES;
connection default; connection default;
DROP TABLE t1; DROP TABLE t1;
--source include/delete_anonymous_users.inc
# #
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock # Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
# #
......
...@@ -597,8 +597,8 @@ drop table t1; ...@@ -597,8 +597,8 @@ drop table t1;
# Test auto_increment # Test auto_increment
# #
connect (con1,localhost,,,test); connect (con1,localhost,root,,test);
connect (con2,localhost,,,test); connect (con2,localhost,root,,test);
create table t1 create table t1
(counter int(64) NOT NULL auto_increment, (counter int(64) NOT NULL auto_increment,
...@@ -631,7 +631,7 @@ drop table t1; ...@@ -631,7 +631,7 @@ drop table t1;
# #
# Bug #17249 delete statement with join where clause fails # Bug #17249 delete statement with join where clause fails
# when table do not have pk # when table do not have pk
# #
create table t1 (a int) engine=ndb; create table t1 (a int) engine=ndb;
create table t2 (a int) engine=ndb; create table t2 (a int) engine=ndb;
......
...@@ -336,8 +336,8 @@ drop table t1; ...@@ -336,8 +336,8 @@ drop table t1;
# bug#7798 # bug#7798
create table t1(a int primary key, b int not null, index(b)); create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2); insert into t1 values (1,1), (2,2);
connect (con1,localhost,,,test); connect (con1,localhost,root,,test);
connect (con2,localhost,,,test); connect (con2,localhost,root,,test);
connection con1; connection con1;
set autocommit=0; set autocommit=0;
begin; begin;
......
...@@ -21,8 +21,8 @@ select * from t2; ...@@ -21,8 +21,8 @@ select * from t2;
show status like 'handler_discover%'; show status like 'handler_discover%';
# Check dropping and recreating table on same server # Check dropping and recreating table on same server
connect (con1,localhost,,,test); connect (con1,localhost,root,,test);
connect (con2,localhost,,,test); connect (con2,localhost,root,,test);
connection con1; connection con1;
select * from t1; select * from t1;
connection con2; connection con2;
......
connect (con1,localhost,boo,,); connect (con1,localhost,root,,);
connection con1; connection con1;
-- error 1064,1102,1280 -- error 1064,1102,1280
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
......
# Test need anonymous user when connection are made as "zedjzlcsjhd"
source include/add_anonymous_users.inc;
-- source include/master-slave.inc -- source include/master-slave.inc
...@@ -207,4 +209,7 @@ select * from t1; ...@@ -207,4 +209,7 @@ select * from t1;
connection master; connection master;
drop table t1; drop table t1;
# Delete the anonymous users
source include/delete_anonymous_users.inc;
# End of 5.1 tests # End of 5.1 tests
...@@ -689,6 +689,17 @@ select @@&; ...@@ -689,6 +689,17 @@ select @@&;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
select @@@; select @@@;
#
# Bug#20166 mysql-test-run.pl does not test system privilege tables creation
#
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@hostname;
--error 1238
set @@hostname= "anothername";
--replace_column 2 #
show variables like 'hostname';
--echo End of 5.0 tests --echo End of 5.0 tests
# This is at the very after the versioned tests, since it involves doing # This is at the very after the versioned tests, since it involves doing
......
...@@ -37,7 +37,7 @@ begin; ...@@ -37,7 +37,7 @@ begin;
--error 1399 --error 1399
create table t2 (a int); create table t2 (a int);
connect (con1,localhost,,,); connect (con1,localhost,root,,);
connection con1; connection con1;
--error 1440 --error 1440
......
...@@ -29,8 +29,7 @@ bin_SCRIPTS = @server_scripts@ \ ...@@ -29,8 +29,7 @@ bin_SCRIPTS = @server_scripts@ \
mysql_find_rows \ mysql_find_rows \
mysqlhotcopy \ mysqlhotcopy \
mysqldumpslow \ mysqldumpslow \
mysqld_multi \ mysqld_multi
mysql_create_system_tables
noinst_SCRIPTS = make_binary_distribution \ noinst_SCRIPTS = make_binary_distribution \
make_sharedlib_distribution make_sharedlib_distribution
...@@ -52,15 +51,18 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ ...@@ -52,15 +51,18 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
mysqlhotcopy.sh \ mysqlhotcopy.sh \
mysqldumpslow.sh \ mysqldumpslow.sh \
mysqld_multi.sh \ mysqld_multi.sh \
mysqld_safe.sh \ mysqld_safe.sh
mysql_create_system_tables.sh
EXTRA_DIST = $(EXTRA_SCRIPTS) \ EXTRA_DIST = $(EXTRA_SCRIPTS) \
mysqlaccess.conf \ mysqlaccess.conf \
mysqlbug \ 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 # mysqlbug should be distributed built so that people can report build
# failures with it. # failures with it.
...@@ -88,6 +90,14 @@ DISTCLEANFILES = mysqlbug ...@@ -88,6 +90,14 @@ DISTCLEANFILES = mysqlbug
# We want the right version and configure comand line in mysqlbug # We want the right version and configure comand line in mysqlbug
mysqlbug: ${top_builddir}/config.status mysqlbug.sh 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 SUFFIXES = .sh
.sh: .sh:
......
This diff is collapsed.
...@@ -175,7 +175,7 @@ s_echo() ...@@ -175,7 +175,7 @@ s_echo()
} }
s_echo "This script updates all the mysql privilege tables to be usable by" s_echo "This script updates all the mysql privilege tables to be usable by"
s_echo "MySQL 5.1 and above." s_echo "the current version of MySQL"
s_echo "" s_echo ""
if test $verbose = 1 if test $verbose = 1
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This scripts creates the privilege tables db, host, user, tables_priv, # This scripts creates the MySQL Server system tables
# columns_priv, procs_priv in the mysql database, as well as the func table.
# #
# All unrecognized arguments to this script are passed to mysqld. # All unrecognized arguments to this script are passed to mysqld.
...@@ -30,6 +29,14 @@ case "$1" in ...@@ -30,6 +29,14 @@ case "$1" in
;; ;;
esac esac
s_echo()
{
if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
echo $1
fi
}
parse_arguments() { parse_arguments() {
# We only need to pass arguments through to the server if we don't # We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on # handle them here. So, we collect unrecognized options (passed on
...@@ -53,9 +60,20 @@ parse_arguments() { ...@@ -53,9 +60,20 @@ parse_arguments() {
# where a chown of datadir won't help) # where a chown of datadir won't help)
user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--skip-name-resolve) ip_only=1 ;; --skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; --verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;; --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" if test -n "$pick_args"
then then
...@@ -93,8 +111,6 @@ bindir= ...@@ -93,8 +111,6 @@ bindir=
basedir= basedir=
srcdir= srcdir=
force=0 force=0
verbose=0
fill_help_tables=""
parse_arguments `$print_defaults $defaults mysqld mysql_install_db` parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
...@@ -119,29 +135,42 @@ else ...@@ -119,29 +135,42 @@ else
fi fi
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" if test -n "$srcdir"
then 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 else
for i in $basedir/support-files $basedir/share $basedir/share/mysql \ for i in $basedir/support-files $basedir/share $basedir/share/mysql \
$basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@ $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@
do do
if test -f $i/fill_help_tables.sql if test -f $i/$fill_help_tables
then then
pkgdatadir=$i pkgdatadir=$i
fi fi
done 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 fi
if test ! -f $fill_help_tables if test ! -f $fill_help_tables
then 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; exit 1;
fi fi
# Find executables and paths
mdata=$ldata/mysql mdata=$ldata/mysql
mysqld=$execdir/mysqld mysqld=$execdir/mysqld
mysqld_opt="" mysqld_opt=""
...@@ -167,7 +196,7 @@ then ...@@ -167,7 +196,7 @@ then
echo "FATAL ERROR $mysqld not found!" echo "FATAL ERROR $mysqld not found!"
exit 1 exit 1
else else
echo "Didn't find $mysqld" echo "FATAL ERROR Didn't find $mysqld"
echo "You should do a 'make install' before executing this script" echo "You should do a 'make install' before executing this script"
exit 1 exit 1
fi fi
...@@ -187,9 +216,10 @@ then ...@@ -187,9 +216,10 @@ then
then then
echo "Neither host '$hostname' nor 'localhost' could be looked up with" echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "$bindir/resolveip" echo "$bindir/resolveip"
echo "Please configure the 'hostname' command to return a correct hostname." echo "Please configure the 'hostname' command to return a correct"
echo "If you want to solve this at a later stage, restart this script with" echo "hostname."
echo "the --force option" echo "If you want to solve this at a later stage, restart this script"
echo "with the --force option"
exit 1 exit 1
fi fi
echo "WARNING: The host '$hostname' could not be looked up with resolveip." echo "WARNING: The host '$hostname' could not be looked up with resolveip."
...@@ -208,86 +238,98 @@ then ...@@ -208,86 +238,98 @@ then
fi fi
# Create database directories mysql & test # Create database directories mysql & test
if test ! -d $ldata; then
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi mkdir $ldata;
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi chmod 700 $ldata ;
if test ! -d $ldata/test; then mkdir $ldata/test; chmod 700 $ldata/test ; fi fi
if test -w / -a ! -z "$user"; then 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; chown $user $ldata $ldata/mysql $ldata/test;
fi
if test ! -f $mdata/db.frm
then
c_d="yes"
fi fi
if test $verbose = 1 # Check is "db" table already exist
if test ! -f $mdata/db.frm
then then
create_option="verbose" db_table_already_exist="yes"
else
create_option="real"
fi fi
if test -n "$user"; then if test -n "$user"; then
args="$args --user=$user" args="$args --user=$user"
fi fi
if test "$in_rpm" -eq 0 -a "$windows" -eq 0 # Peform the install of system tables
then
echo "Installing all prepared tables"
fi
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
--skip-grant-tables --basedir=$basedir --datadir=$ldata --skip-innodb \ --basedir=$basedir --datadir=$ldata --skip-innodb \
--skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" --skip-ndbcluster $args --max_allowed_packet=8M \
if $scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows \ --net_buffer_length=16K"
| eval "$mysqld_install_cmd_line"
# 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 then
s_echo "OK"
if test -n "$fill_help_tables" if test -n "$fill_help_tables"
then then
if test "$in_rpm" -eq 0 -a "$windows" -eq 0 s_echo "Filling help tables..."
then # Pipe fill_help_tables.sql to "mysqld --bootstrap"
echo "Fill help tables" if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line`
fi
(echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line"
res=$?
if test $res != 0
then then
# Fill suceeded
s_echo "OK"
else
echo "" echo ""
echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
echo "The \"HELP\" command might not work properly" echo "The \"HELP\" command might not work properly"
echo "" echo ""
fi fi
fi fi
if test "$in_rpm" = 0 -a "$windows" = 0
then s_echo ""
echo "" s_echo "To start mysqld at boot time you have to copy"
echo "To start mysqld at boot time you have to copy support-files/mysql.server" s_echo "support-files/mysql.server to the right place for your system"
echo "to the right place for your system" s_echo
echo
fi
if test "$windows" -eq 0 if test "$windows" -eq 0
then then
# 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 "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
echo "To do so, start the server, then issue the following commands:" 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 password 'new-password'"
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions." echo "See the manual for more instructions."
#
# Print message about upgrading unless we have created a new db table. # Print message about upgrading unless we have created a new db table.
if test -z "$c_d" if test -z "$db_table_already_exist"
then then
echo echo
echo "NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run" echo "NOTE: If you are upgrading from a previous MySQL verision you "
echo "the $bindir/mysql_fix_privilege_tables. Otherwise you will not be" echo "should run '$bindir/mysql_upgrade', to make sure all tables have "
echo "able to use the new GRANT command!" echo "been upgraded for this version of MySQL"
fi fi
echo echo
if test "$in_rpm" = "0" if test "$in_rpm" = "0"
then then
echo "You can start the MySQL daemon with:" echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &" echo "cd @prefix@ ; $bindir/mysqld_safe &"
echo echo
echo "You can test the MySQL daemon with mysql-test-run.pl"
echo "cd mysql-test ; perl mysql-test-run.pl"
echo
fi fi
echo "Please report any problems with the @scriptdir@/mysqlbug script!" echo "Please report any problems with the @scriptdir@/mysqlbug script!"
echo echo
...@@ -300,9 +342,9 @@ else ...@@ -300,9 +342,9 @@ else
echo "Installation of system tables failed!" echo "Installation of system tables failed!"
echo echo
echo "Examine the logs in $ldata for more information." 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 "$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 "$bindir/mysql to connect to the mysql"
echo "database and look at the grant tables:" echo "database and look at the grant tables:"
echo echo
......
This diff is collapsed.
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);
...@@ -75,7 +75,7 @@ sql_print_message_func sql_print_message_handlers[3] = ...@@ -75,7 +75,7 @@ sql_print_message_func sql_print_message_handlers[3] =
char *make_default_log_name(char *buff,const char* log_ext) char *make_default_log_name(char *buff,const char* log_ext)
{ {
strmake(buff, glob_hostname, FN_REFLEN-5); strmake(buff, pidfile_name, FN_REFLEN-5);
return fn_format(buff, buff, mysql_data_home, log_ext, return fn_format(buff, buff, mysql_data_home, log_ext,
MYF(MY_UNPACK_FILENAME|MY_APPEND_EXT)); MYF(MY_UNPACK_FILENAME|MY_APPEND_EXT));
} }
...@@ -2297,7 +2297,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name, ...@@ -2297,7 +2297,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
TODO: The following should be using fn_format(); We just need to TODO: The following should be using fn_format(); We just need to
first change fn_format() to cut the file name if it's too long. first change fn_format() to cut the file name if it's too long.
*/ */
strmake(buff, glob_hostname, FN_REFLEN - 5); strmake(buff, pidfile_name, FN_REFLEN - 5);
strmov(fn_ext(buff), suffix); strmov(fn_ext(buff), suffix);
return (const char *)buff; return (const char *)buff;
} }
......
...@@ -2677,8 +2677,14 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2677,8 +2677,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
*/ */
mysql_bin_log.init_pthread_objects(); mysql_bin_log.init_pthread_objects();
if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
strmov(glob_hostname,"mysql"); {
strmake(glob_hostname, STRING_WITH_LEN("localhost"));
sql_print_warning("gethostname failed, using '%s' as hostname",
glob_hostname);
strmake(pidfile_name, STRING_WITH_LEN("mysql"));
}
else
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
...@@ -3137,7 +3143,7 @@ static int init_server_components() ...@@ -3137,7 +3143,7 @@ static int init_server_components()
if (opt_error_log) if (opt_error_log)
{ {
if (!log_error_file_ptr[0]) if (!log_error_file_ptr[0])
fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */ MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
else else
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
......
...@@ -655,6 +655,10 @@ sys_var_thd_time_zone sys_time_zone("time_zone"); ...@@ -655,6 +655,10 @@ sys_var_thd_time_zone sys_time_zone("time_zone");
/* Read only variables */ /* Read only variables */
/* Global read-only variable containing hostname */
sys_var_const_str sys_hostname("hostname", glob_hostname);
sys_var_have_variable sys_have_compress("have_compress", &have_compress); sys_var_have_variable sys_have_compress("have_compress", &have_compress);
sys_var_have_variable sys_have_crypt("have_crypt", &have_crypt); sys_var_have_variable sys_have_crypt("have_crypt", &have_crypt);
sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db); sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db);
...@@ -779,6 +783,7 @@ SHOW_VAR init_vars[]= { ...@@ -779,6 +783,7 @@ SHOW_VAR init_vars[]= {
{sys_var_general_log.name, (char*) &opt_log, SHOW_MY_BOOL}, {sys_var_general_log.name, (char*) &opt_log, SHOW_MY_BOOL},
{sys_var_general_log_path.name, (char*) &sys_var_general_log_path, SHOW_SYS}, {sys_var_general_log_path.name, (char*) &sys_var_general_log_path, SHOW_SYS},
{sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS}, {sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS},
{sys_hostname.name, (char*) &sys_hostname, SHOW_SYS},
{sys_have_compress.name, (char*) &have_compress, SHOW_HAVE}, {sys_have_compress.name, (char*) &have_compress, SHOW_HAVE},
{sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE}, {sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE},
{sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE}, {sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE},
......
...@@ -1359,6 +1359,7 @@ pthread_handler_t handle_bootstrap(void *arg) ...@@ -1359,6 +1359,7 @@ pthread_handler_t handle_bootstrap(void *arg)
thd->query= thd->memdup_w_gap(buff, length+1, thd->query= thd->memdup_w_gap(buff, length+1,
thd->db_length+1+QUERY_CACHE_FLAGS_SIZE); thd->db_length+1+QUERY_CACHE_FLAGS_SIZE);
thd->query[length] = '\0'; thd->query[length] = '\0';
DBUG_PRINT("query",("%-.4096s",thd->query));
/* /*
We don't need to obtain LOCK_thread_count here because in bootstrap We don't need to obtain LOCK_thread_count here because in bootstrap
mode we have only one thread. mode we have only one thread.
...@@ -1366,16 +1367,26 @@ pthread_handler_t handle_bootstrap(void *arg) ...@@ -1366,16 +1367,26 @@ pthread_handler_t handle_bootstrap(void *arg)
thd->query_id=next_query_id(); thd->query_id=next_query_id();
mysql_parse(thd,thd->query,length); mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables close_thread_tables(thd); // Free tables
if (thd->is_fatal_error) if (thd->is_fatal_error)
break; break;
if (thd->net.report_error)
{
/* The query failed, send error to log and abort bootstrap */
net_send_error(thd);
thd->fatal_error();
break;
}
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
#ifdef USING_TRANSACTIONS #ifdef USING_TRANSACTIONS
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
#endif #endif
} }
/* thd->fatal_error should be set in case something went wrong */
end: end:
/* Remember the exit code of bootstrap */
bootstrap_error= thd->is_fatal_error; bootstrap_error= thd->is_fatal_error;
net_end(&thd->net); net_end(&thd->net);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment