Skip to content

Commit d90df45

Browse files
committed
WL#8326 Make NO_AUTO_CREATE_USER sql_mode behavior the default in 5.7
* NO_AUTO_CREATE_USER mode added to the default set (compiled-in) of the sql_mode global variable. * Server reports missing NO_AUTO_CREATE_USER mode of the sql_mode variable during boot time. The initial value of the sql_mode is stored in the configuration file (*.cnf). * Switching on and off NO_AUTO_CREATE_USER mode of the sql_mode variable reports warning.
1 parent 1b863fb commit d90df45

File tree

736 files changed

+9745
-3354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

736 files changed

+9745
-3354
lines changed

mysql-test/extra/rpl_tests/rpl_sp.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ create procedure foo3()
8686
insert into t1 values (15);
8787

8888
# let's create a non-privileged user
89+
set @orig_sql_mode= @@sql_mode;
90+
set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
8991
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
92+
set sql_mode= @orig_sql_mode;
9093
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
9194
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
9295

mysql-test/include/grant_cache.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ show status like "Qcache_queries_in_cache";
7575
show status like "Qcache_hits%";
7676

7777
# Create the test users
78+
set @orig_sql_mode= @@sql_mode;
79+
set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
7880
grant SELECT on mysqltest.* to mysqltest_1@localhost;
7981
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
8082
grant SELECT on test.t1 to mysqltest_2@localhost;
8183
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
84+
set sql_mode= @orig_sql_mode;
8285

8386
# The following queries should be fetched from cache
8487
--echo ----- establish connection user1 (user=mysqltest_1) -----

mysql-test/include/mtr_warnings.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ INSERT INTO global_suppressions VALUES
177177
("No existing UUID has been found, so we assume that this is the first time that this server has been started.*"),
178178
/*It will print a warning if server is run without --explicit_defaults_for_timestamp.*/
179179
("TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details)*"),
180+
/*It will print a warning if a server is run without NO_AUTO_CREATE_USER sql mode.*/
181+
("'NO_AUTO_CREATE_USER' sql mode is not set. It will be made read-only in a future release."),
180182

181183
/* Added 2009-08-XX after fixing Bug #42408 */
182184

mysql-test/include/wl6301.inc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ foreach my $ip (@ipv4_addresses)
2121
{
2222
print LOGFH "- ipv4: '$ip'\n";
2323

24+
my $rc =
25+
system(
26+
"$MYSQL " .
27+
"--host=127.0.0.1 " .
28+
"--port=$MASTER_MYPORT " .
29+
"--user=root " .
30+
"test " .
31+
"-e 'CREATE USER u1@$ip;'");
32+
33+
print LOGFH " CREATE status: $rc\n";
34+
35+
$ipv4_failed |= $rc;
36+
2437
my $rc =
2538
system(
2639
"$MYSQL " .
@@ -66,6 +79,19 @@ foreach my $ip (@ipv6_addresses)
6679
{
6780
print LOGFH "- ipv6: '$ip'\n";
6881

82+
my $rc =
83+
system(
84+
"$MYSQL " .
85+
"--host=127.0.0.1 " .
86+
"--port=$MASTER_MYPORT " .
87+
"--user=root " .
88+
"test " .
89+
"-e 'CREATE USER u1@$ip;'");
90+
91+
print LOGFH " CREATE status: $rc\n";
92+
93+
$ipv4_failed |= $rc;
94+
6995
my $rc =
7096
system(
7197
"$MYSQL " .

mysql-test/r/alias.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
DROP TABLE IF EXISTS t1;
22
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
3+
Warnings:
4+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
35
CREATE TABLE t1 (
46
cont_nr int(11) NOT NULL auto_increment,
57
ver_nr int(11) NOT NULL default '0',

mysql-test/r/alter_table.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
drop table if exists t1,t2;
22
drop database if exists mysqltest;
33
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
4+
Warnings:
5+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
46
create table t1 (
57
col1 int not null auto_increment primary key,
68
col2 varchar(30) not null,
@@ -2649,6 +2651,8 @@ DROP TABLE t1;
26492651
# ALTER_COLUMN_EQUAL_PACK_LENGTH
26502652
SET @orig_sql_mode = @@sql_mode;
26512653
SET sql_mode= '';
2654+
Warnings:
2655+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
26522656
# Test with '767' as index size limit.
26532657
SET GLOBAL innodb_large_prefix=OFF;
26542658
Warnings:
@@ -2681,6 +2685,8 @@ COUNT(*)
26812685
# Cleanup.
26822686
DROP TABLE t1;
26832687
SET sql_mode= @orig_sql_mode;
2688+
Warnings:
2689+
Warning 3090 Setting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
26842690
# BUG#17246318 - ALTER TABLE SHOULD NOT ALLOW CREATION OF TABLES
26852691
# WITH BOTH 5.5 AND 5.6 TEMPORALS
26862692
#

mysql-test/r/ansi.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
drop table if exists t1;
22
set sql_mode="MySQL40";
3+
Warnings:
4+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
35
select @@sql_mode;
46
@@sql_mode
57
MYSQL40,HIGH_NOT_PRECEDENCE

mysql-test/r/archive.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12879,6 +12879,8 @@ DROP TABLE IF EXISTS t1;
1287912879
CREATE TABLE t1 (c1 decimal(19,14) NOT NULL) ENGINE=ARCHIVE;
1288012880
CALL mtr.add_suppression("Found wrong key definition in #sql.* Please do \"ALTER TABLE `#sql.*` FORCE \" to fix it!");
1288112881
SET sql_mode='NO_ENGINE_SUBSTITUTION';
12882+
Warnings:
12883+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
1288212884
CREATE INDEX i1 ON t1(c1);
1288312885
ERROR HY000: Got error -1 from storage engine
1288412886
SHOW WARNINGS;

mysql-test/r/archive_symlink.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ DROP TABLE t1;
2929
#
3030
SET @org_mode=@@sql_mode;
3131
SET @@sql_mode='NO_DIR_IN_CREATE';
32+
Warnings:
33+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
3234
SELECT @@sql_mode;
3335
@@sql_mode
3436
NO_DIR_IN_CREATE
@@ -42,6 +44,8 @@ INSERT INTO t1 VALUES (NULL, "yellow");
4244
# Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
4345
DROP TABLE t1;
4446
set @@sql_mode=@org_mode;
47+
Warnings:
48+
Warning 3090 Setting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
4549
#
4650
# MySQL engine does not allow DATA DIRECTORY to be
4751
# within --datadir for any engine, including Archive

mysql-test/r/auto_increment.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ a
134134
2
135135
drop table t1;
136136
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
137+
Warnings:
138+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
137139
create table t1 (i tinyint unsigned not null auto_increment primary key);
138140
insert into t1 set i = 254;
139141
insert into t1 set i = null;
@@ -188,6 +190,8 @@ drop table t1;
188190
SET sql_mode = default;
189191
create table t1(a int auto_increment,b int null,primary key(a));
190192
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
193+
Warnings:
194+
Warning 3129 Unsetting sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be made read-only in a future release.
191195
insert into t1(a,b)values(NULL,1);
192196
insert into t1(a,b)values(200,2);
193197
insert into t1(a,b)values(0,3);

0 commit comments

Comments
 (0)