Debian Codegraph @

mysql-test/suite/sys_vars/t/print_identified_with_as_hex_basic.test

raw
1 # Save the initial number of concurrent sessions
2 --source include/count_sessions.inc
3
4 --echo # Should be off by default
5 SELECT @@GLOBAL.print_identified_with_as_hex, @@SESSION.print_identified_with_as_hex;
6 SET GLOBAL print_identified_with_as_hex=1;
7 SELECT @@GLOBAL.print_identified_with_as_hex, @@SESSION.print_identified_with_as_hex;
8 SET SESSION print_identified_with_as_hex=1;
9 SELECT @GLOBAL.print_identified_with_as_hex, @@SESSION.print_identified_with_as_hex;
10
11 --echo # This corresponds to CREATE USER foo@localhost IDENTIFIED BY 'bar'
12 --echo # But because of the salt we peg the whole hash instead.
13 CREATE USER 'foo'@'localhost' IDENTIFIED WITH 'caching_sha2_password' AS 0x244124303035240C4D7A6D25436F2C0A08515310644615383E2A123961484C6276734178425A446172436B58446A582F6178544A692E6F644E4F2F4E596E666276454B563336 REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT;
14 CREATE USER oldfoo@localhost IDENTIFIED WITH 'mysql_native_password' BY 'bar';
15 --echo # Should display hex: unprintable symbols
16 SHOW CREATE USER foo@localhost;
17 --echo # Should not display hex: native passwords not having non-printable bytes
18 SHOW CREATE USER oldfoo@localhost;
19 SET SESSION print_identified_with_as_hex=0;
20 --echo # Should not display hex: turned off
21 SHOW CREATE USER foo@localhost;
22 --echo # Should not display hex: turned off
23 SHOW CREATE USER oldfoo@localhost;
24
25 --echo # Now try to reply the statement produced by SHOW CREATE
26 --exec $MYSQL -e "SHOW CREATE USER foo@localhost" -s -s -s > $MYSQLTEST_VARDIR/tmp/hex_user.sql
27 DROP USER foo@localhost;
28 --echo # Replaying the collected statement
29 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/hex_user.sql
30 --echo # Connecting as foo: should work
31 connect(con1,localhost,foo,bar,test);
32 SELECT 1;
33 --echo # back to default connection
34 connection default;
35 disconnect con1;
36
37 --echo # Cleanup
38 --remove_file $MYSQLTEST_VARDIR/tmp/hex_user.sql
39 DROP USER foo@localhost,oldfoo@localhost;
40 SET GLOBAL print_identified_with_as_hex=default;
41
42 # Wait till all disconnects are completed
43 --source include/wait_until_count_sessions.inc