You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug #21807286: "CREATE USER IF NOT EXISTS" REPORTS AN ERROR
CREATE|ALTER IF [NOT] EXISTS ... IDENTIFIED BY ... was failing
if the user existed(not existed for alter) and raw error log was
off due to considerations of wrong binlogging in that case.
Converted this to a warning (regardless of the raw log option)
because this is how it operates without the IDENTIFIED BY option.
Logging IDENTIFIED BY is safe, since it's converted on the fly to
IDENTIFIED WITH (hence is not revealing the password).
Also made sure that the warning for a user is not counted towards
the number of users successfully processed by CREATE USER.
Also made sure that the IDENTIFIED clauses are handled properly
when binlogged.
Added test case and updated the existing tests to cover the change.
Now logging of all user operations involving credentials that
are a no-op on the master is inhibited.
Copy file name to clipboardExpand all lines: mysql-test/suite/binlog/r/binlog_user_if_exists.result
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,30 @@ Note 3163 User 'u1'@'localhost' already exists.
16
16
ALTER USER IF EXISTS u1@localhost ACCOUNT LOCK;
17
17
DROP USER u1@localhost;
18
18
DROP USER IF EXISTS u2@localhost;
19
+
#
20
+
# Bug #21807286: "CREATE USER IF NOT EXISTS" REPORTS AN ERROR
21
+
#
22
+
CREATE USER IF NOT EXISTS b21807286@localhost IDENTIFIED BY 'haha';
23
+
CREATE USER IF NOT EXISTS b21807286@localhost IDENTIFIED BY 'haha2';
24
+
Warnings:
25
+
Note 3163 User 'b21807286'@'localhost' already exists.
26
+
ALTER USER IF EXISTS b21807286@localhost IDENTIFIED BY 'haha3';
27
+
ALTER USER IF EXISTS b21807286_not_exists@localhost IDENTIFIED BY 'haha4';
28
+
Warnings:
29
+
Note 3162 User 'b21807286_not_exists'@'localhost' does not exist.
30
+
DROP USER b21807286@localhost;
19
31
include/sync_slave_sql_with_master.inc
20
32
[On Slave]
21
33
include/show_binlog_events.inc
22
34
Log_name Pos Event_type Server_id End_log_pos Info
23
35
slave-bin.000001 # Query # # use `test`; CREATE USER 'u1'@'localhost' IDENTIFIED WITH 'mysql_native_password'
24
-
slave-bin.000001 # Query # # use `test`; CREATE USER IF NOT EXISTS 'u1'@'localhost' IDENTIFIED WITH 'mysql_native_password','u2'@'localhost' IDENTIFIED WITH 'mysql_native_password'
36
+
slave-bin.000001 # Query # # use `test`; CREATE USER IF NOT EXISTS 'u2'@'localhost' IDENTIFIED WITH 'mysql_native_password'
25
37
slave-bin.000001 # Query # # use `test`; ALTER USER IF EXISTS 'u1'@'localhost' ACCOUNT LOCK
26
38
slave-bin.000001 # Query # # use `test`; DROP USER u1@localhost
27
39
slave-bin.000001 # Query # # use `test`; DROP USER IF EXISTS u2@localhost
40
+
slave-bin.000001 # Query # # use `test`; CREATE USER IF NOT EXISTS 'b21807286'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*85D0F19E5598AC04AC7B3FCF5383247D28FB59EF'
41
+
slave-bin.000001 # Query # # use `test`; ALTER USER IF EXISTS 'b21807286'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*7B8BEAA4240FE1A214BFAEDD99FB3842E4234E5E'
42
+
slave-bin.000001 # Query # # use `test`; DROP USER b21807286@localhost
0 commit comments