1
# auth_file has to be used to provide access for user root, else the tests
2
# won't work. auth_schema can't provide this access because no one has
3
# access until the auth table is created.
5
# Check that the plugin is loaded and using the default auth.users table.
6
SHOW VARIABLES LIKE 'auth_schema%';
8
# mysql_protocol provides MYSQL_PASSWORD().
9
SELECT MYSQL_PASSWORD('test_pass');
14
user VARCHAR(255) NOT NULL,
16
UNIQUE INDEX user_idx (user)
18
INSERT INTO users VALUES ('test_user', '34F2496C75CF8F8D8EBE14067C9C8B1AA8E80DEF');
20
SELECT * FROM users ORDER BY user;
22
connect(conn1, localhost, test_user, test_pass,,);
24
SELECT 'connection 1 works';
26
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 1 works'" --user=test_user --password=test_pass 2>&1
28
# Test that bad passwords aren't accepted.
29
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
30
--replace_regex /@'.*?'/@'LOCALHOST'/
31
--error ER_ACCESS_DENIED_ERROR
32
connect (bad_user,localhost,test_user,foo,,);
34
# Test that the auth table can be changed dynamically.
37
user VARCHAR(255) NOT NULL,
39
UNIQUE INDEX user_idx (user)
41
INSERT INTO users2 VALUES ('test_user2', '34F2496C75CF8F8D8EBE14067C9C8B1AA8E80DEF');
42
SELECT * FROM users2 ORDER BY user;
44
SET GLOBAL auth_schema_table='auth.users2';
45
SHOW VARIABLES LIKE 'auth_schema%';
47
connect(conn2, localhost, test_user2, test_pass,,);
49
SELECT 'connection 2 works';
51
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 2 works'" --user=test_user2 --password=test_pass 2>&1
53
# Restore the original auth table for subsequent tests (or --repeat 2).
54
SET GLOBAL auth_schema_table='auth.users';
56
# Test that auth_schema works with hex strings created MYSQL_PASSWORD().
57
INSERT INTO auth.users VALUES ('test_user3', MYSQL_PASSWORD('mypass'));
58
SELECT * FROM auth.users WHERE user='test_user3';
60
--exec $TOP_BUILDDIR/client/drizzle --host=localhost --port=$MASTER_MYPORT -e "SELECT 'client 3 works'" --user=test_user3 --password=mypass 2>&1