summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/alter_user.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:07:14 +0000
commita175314c3e5827eb193872241446f2f8f5c9d33c (patch)
treecd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/main/alter_user.test
parentInitial commit. (diff)
downloadmariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz
mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/alter_user.test')
-rw-r--r--mysql-test/main/alter_user.test109
1 files changed, 109 insertions, 0 deletions
diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test
new file mode 100644
index 00000000..37f77c26
--- /dev/null
+++ b/mysql-test/main/alter_user.test
@@ -0,0 +1,109 @@
+--source include/not_embedded.inc
+
+select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
+
+select * from mysql.user where user = 'root' and host = 'localhost';
+--echo # Test syntax
+--echo #
+--echo # These 2 selects should have no changes from the first one.
+alter user CURRENT_USER;
+select * from mysql.user where user = 'root' and host = 'localhost';
+alter user CURRENT_USER();
+select * from mysql.user where user = 'root' and host = 'localhost';
+
+create user foo;
+select * from mysql.user where user = 'foo';
+alter user foo;
+select * from mysql.user where user = 'foo';
+
+--echo #
+--echo # Test READ_ONLY privilege works correctly with a read only database.
+--echo #
+
+SET @start_read_only = @@global.read_only;
+SET GLOBAL read_only=1;
+grant create user on *.* to foo;
+
+--echo # Currently no READ_ONLY ADMIN privileges.
+connect (a, localhost, foo);
+select @@global.read_only;
+
+--error ER_OPTION_PREVENTS_STATEMENT
+alter user foo;
+
+--echo # Grant READ_ONLY ADMIN privilege to the user.
+connection default;
+grant READ_ONLY ADMIN on *.* to foo;
+
+--echo # We now have READ_ONLY ADMIN privilege. We should be able to run alter user.
+connect (b, localhost, foo);
+alter user foo;
+
+connection default;
+SET GLOBAL read_only = @start_read_only;
+
+
+--echo #
+--echo # Test inexistant user.
+--echo #
+
+--error ER_CANNOT_USER
+alter user boo;
+--echo #--warning ER_CANNOT_USER
+alter user if exists boo;
+
+
+--echo #
+--echo # Test password related altering.
+--echo #
+
+alter user foo identified by 'something';
+select * from mysql.user where user = 'foo';
+
+alter user foo identified by 'something2';
+select * from mysql.user where user = 'foo';
+
+alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63';
+select * from mysql.user where user = 'foo';
+
+alter user foo identified by password 'invalid';
+select * from mysql.user where user = 'foo';
+
+--error ER_CANNOT_USER
+alter user foo identified with 'somecoolplugin';
+show warnings;
+
+alter user foo identified with 'mysql_old_password';
+select * from mysql.user where user = 'foo';
+
+alter user foo identified with 'mysql_old_password' using '0123456789ABCDEF';
+select * from mysql.user where user = 'foo';
+
+
+--echo #
+--echo # Test ssl related altering.
+--echo #
+
+alter user foo identified by 'something' require SSL;
+select * from mysql.user where user = 'foo';
+
+alter user foo identified by 'something' require X509;
+select * from mysql.user where user = 'foo';
+
+alter user foo identified by 'something'
+require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
+select * from mysql.user where user = 'foo';
+
+
+--echo #
+--echo # Test resource limits altering.
+--echo #
+
+alter user foo with MAX_QUERIES_PER_HOUR 10
+ MAX_UPDATES_PER_HOUR 20
+ MAX_CONNECTIONS_PER_HOUR 30
+ MAX_USER_CONNECTIONS 40;
+select * from mysql.user where user = 'foo';
+drop user foo;
+
+update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';