1set global secure_auth=0;
2create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
3create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
4create user newpassnat@localhost identified via 'mysql_native_password';
5set password for newpassnat@localhost = '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
6create user oldauth@localhost identified with 'mysql_old_password' using '378b243e220ca493';
7create user oldpass@localhost identified by password '378b243e220ca493';
8create user oldpassold@localhost identified with 'mysql_old_password';
9set password for oldpassold@localhost = '378b243e220ca493';
10select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
11user	host	password	plugin	authentication_string
12natauth	localhost	*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
13newpass	localhost	*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
14newpassnat	localhost	*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29	mysql_native_password	*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
15oldauth	localhost	378b243e220ca493
16oldpass	localhost	378b243e220ca493
17oldpassold	localhost	378b243e220ca493	mysql_old_password	378b243e220ca493
18connect con,localhost,natauth,test,;
19select current_user();
20current_user()
21natauth@localhost
22disconnect con;
23connect con,localhost,newpass,test,;
24select current_user();
25current_user()
26newpass@localhost
27disconnect con;
28connect con,localhost,newpassnat,test,;
29select current_user();
30current_user()
31newpassnat@localhost
32disconnect con;
33connect con,localhost,oldauth,test,;
34select current_user();
35current_user()
36oldauth@localhost
37disconnect con;
38connect con,localhost,oldpass,test,;
39select current_user();
40current_user()
41oldpass@localhost
42disconnect con;
43connect con,localhost,oldpassold,test,;
44select current_user();
45current_user()
46oldpassold@localhost
47disconnect con;
48connection default;
49flush privileges;
50connect con,localhost,natauth,test,;
51select current_user();
52current_user()
53natauth@localhost
54disconnect con;
55connect con,localhost,newpass,test,;
56select current_user();
57current_user()
58newpass@localhost
59disconnect con;
60connect con,localhost,newpassnat,test,;
61select current_user();
62current_user()
63newpassnat@localhost
64disconnect con;
65connect con,localhost,oldauth,test,;
66select current_user();
67current_user()
68oldauth@localhost
69disconnect con;
70connect con,localhost,oldpass,test,;
71select current_user();
72current_user()
73oldpass@localhost
74disconnect con;
75connect con,localhost,oldpassold,test,;
76select current_user();
77current_user()
78oldpassold@localhost
79disconnect con;
80connection default;
81set password for natauth@localhost = PASSWORD('test2');
82set password for newpass@localhost = PASSWORD('test2');
83set password for newpassnat@localhost = PASSWORD('test2');
84set password for oldauth@localhost = PASSWORD('test2');
85set password for oldpass@localhost = PASSWORD('test2');
86set password for oldpassold@localhost = PASSWORD('test2');
87select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
88user	host	password	plugin	authentication_string
89natauth	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
90newpass	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
91newpassnat	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
92oldauth	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
93oldpass	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
94oldpassold	localhost	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E	mysql_native_password	*7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
95connect con,localhost,natauth,test2,;
96select current_user();
97current_user()
98natauth@localhost
99disconnect con;
100connect con,localhost,newpass,test2,;
101select current_user();
102current_user()
103newpass@localhost
104disconnect con;
105connect con,localhost,newpassnat,test2,;
106select current_user();
107current_user()
108newpassnat@localhost
109disconnect con;
110connect con,localhost,oldauth,test2,;
111select current_user();
112current_user()
113oldauth@localhost
114disconnect con;
115connect con,localhost,oldpass,test2,;
116select current_user();
117current_user()
118oldpass@localhost
119disconnect con;
120connect con,localhost,oldpassold,test2,;
121select current_user();
122current_user()
123oldpassold@localhost
124disconnect con;
125connection default;
126flush privileges;
127connect con,localhost,natauth,test2,;
128select current_user();
129current_user()
130natauth@localhost
131disconnect con;
132connect con,localhost,newpass,test2,;
133select current_user();
134current_user()
135newpass@localhost
136disconnect con;
137connect con,localhost,newpassnat,test2,;
138select current_user();
139current_user()
140newpassnat@localhost
141disconnect con;
142connect con,localhost,oldauth,test2,;
143select current_user();
144current_user()
145oldauth@localhost
146disconnect con;
147connect con,localhost,oldpass,test2,;
148select current_user();
149current_user()
150oldpass@localhost
151disconnect con;
152connect con,localhost,oldpassold,test2,;
153select current_user();
154current_user()
155oldpassold@localhost
156disconnect con;
157connection default;
158drop user natauth@localhost, newpass@localhost, newpassnat@localhost;
159drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost;
160set global secure_auth=default;
161create user foo@localhost identified with mysql_native_password;
162update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost';
163set password for 'foo'@'localhost' = password('bar');
164flush privileges;
165connect foo, localhost, foo, bar;
166select user(), current_user();
167user()	current_user()
168foo@localhost	foo@localhost
169show grants;
170Grants for foo@localhost
171GRANT USAGE ON *.* TO `foo`@`localhost` IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
172disconnect foo;
173connection default;
174select user,host,password,plugin,authentication_string from mysql.user where user='foo';
175user	host	password	plugin	authentication_string
176foo	localhost	*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB	mysql_native_password	*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
177set password for 'foo'@'localhost' = '';
178select user,host,password,plugin,authentication_string from mysql.user where user='foo';
179user	host	password	plugin	authentication_string
180foo	localhost		mysql_native_password
181drop user foo@localhost;
182