mysql5/mysql-5.7.27/mysql-test/suite/ndb/r/ndb_dist_priv.result

181 lines
6.4 KiB
Plaintext

call mysql.mysql_cluster_move_privileges();
select mysql.mysql_cluster_privileges_are_distributed();
mysql.mysql_cluster_privileges_are_distributed()
1
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) engine = ndb;
INSERT INTO t1 VALUES(0,0),(1,1),(2,2);
CREATE USER 'user'@'localhost' IDENTIFIED by 'mypass';
GRANT UPDATE ON t1 TO 'user'@'localhost';
SET PASSWORD FOR 'user'@'localhost'= 'newpass';
RENAME USER 'user'@'localhost' TO 'newuser'@'localhost';
GRANT SELECT ON test.* TO 'newuser'@'localhost' IDENTIFIED by 'mypass2';
Warnings:
Warning 1287 Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in future release. Use ALTER USER statement for this operation.
CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass';
GRANT SELECT ON test.t1 TO 'user2'@'localhost';
select distinct User,Authentication_string from mysql.user order by User;
User Authentication_string
newuser *1E9649BB3F345563008E37641B407AFF50E5835C
root
user2 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user2 Select
CREATE USER 'user'@'localhost';
grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION;
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user2 Select
GRANT SELECT ON test.t1 TO 'user'@'localhost';
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user Select
user2 Select
FLUSH PRIVILEGES;
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user Select
user2 Select
REVOKE SELECT ON test.t1 FROM 'user'@'localhost';
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user2 Select
CREATE USER 'user3'@'localhost' IDENTIFIED by 'mypass';
select distinct User,Authentication_string from mysql.user order by User;
User Authentication_string
newuser *1E9649BB3F345563008E37641B407AFF50E5835C
root
user
user2 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
user3 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
newuser Update
user2 Select
REVOKE UPDATE ON t1 FROM 'newuser'@'localhost';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
user2 Select
GRANT SELECT (a) ON test.t1 TO 'user'@'localhost';
select User, Table_name, Column_name from mysql.columns_priv ORDER BY User;
User Table_name Column_name
user t1 a
FLUSH PRIVILEGES;
select distinct User,Authentication_string from mysql.user order by User;
User Authentication_string
newuser *1E9649BB3F345563008E37641B407AFF50E5835C
root
user
user2 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
user3 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
user
user2 Select
select User, Table_name, Column_name from mysql.columns_priv ORDER BY User;
User Table_name Column_name
user t1 a
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user2'@'localhost';
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
user
select distinct User,Authentication_string from mysql.user order by User;
User Authentication_string
newuser *1E9649BB3F345563008E37641B407AFF50E5835C
root
user
user2 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
user3 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4
select User,Table_priv from mysql.tables_priv ORDER BY User;
User Table_priv
user
connect(127.0.0.1,magnus,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'magnus'@'localhost' (using password: NO)
connect(127.0.0.1,magnus,,test,MASTER_PORT1,MASTER_SOCKET);
ERROR 28000: Access denied for user 'magnus'@'localhost' (using password: NO)
CREATE USER 'billy1'@'127.0.0.1' IDENTIFIED by 'mypass';
SELECT USER();
USER()
billy1@localhost
SELECT * FROM t1 order by pk;
pk a
0 0
1 1
2 2
connect(127.0.0.1,billy1,,test,MASTER_PORT1,MASTER_SOCKET);
ERROR 28000: Access denied for user 'billy1'@'localhost' (using password: NO)
connect(127.0.0.1,billy1,wrongpass,test,MASTER_PORT1,MASTER_SOCKET);
ERROR 28000: Access denied for user 'billy1'@'localhost' (using password: YES)
BEGIN;
UPDATE mysql.user SET Authentication_string = ''
WHERE User = 'billy1';
SET PASSWORD FOR 'billy1'@'127.0.0.1' = 'newpass';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW WARNINGS;
Level Code Message
Warning 1297 Got temporary error 266 'Time-out in NDB, probably caused by deadlock' from NDB
Error 1205 Lock wait timeout exceeded; try restarting transaction
Warning 1297 Got temporary error 274 'Time-out in NDB, probably caused by deadlock' from NDB
Warning 1297 Got temporary error 274 'Time-out in NDB, probably caused by deadlock' from NDB
Error 1205 Lock wait timeout exceeded; try restarting transaction
ROLLBACK;
DROP USER 'billy1'@'127.0.0.1';
set @orig_sql_mode= @@sql_mode;
set SESSION sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
Warnings:
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
GRANT ALL ON *.* TO 'billy2'@'127.0.0.1';
Warnings:
Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.
set SESSION sql_mode = @orig_sql_mode;
Warnings:
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
SELECT USER();
USER()
billy2@localhost
SELECT * FROM t1 order by pk;
pk a
0 0
1 1
2 2
DROP USER 'billy2'@'127.0.0.1';
=== making backup of new users ===
call mysql.mysql_cluster_backup_privileges();
==== clean up ====
DROP USER 'newuser'@'localhost';
DROP USER 'user2'@'localhost';
DROP USER 'user3'@'localhost';
DROP TABLE t1;
=== test restart of mysqld ===
# restart
flush privileges;
=== test truncate ===
truncate mysql.proxies_priv;
flush privileges;
=== test mysql_upgrade ===
mysql_upgrade first mysqld...
mysql_upgrade second mysqld...
show that tables still are in NDB
table_name
columns_priv
db
procs_priv
proxies_priv
tables_priv
user
=== test mysql_upgrade of two mysqlds ===
DROP DATABASE sys;
DROP DATABASE sys;
mysql_upgrade first mysqld...
mysql_upgrade second mysqld...
call mysql.mysql_cluster_backup_privileges();
call mysql.mysql_cluster_backup_privileges();
call mysql.mysql_cluster_restore_local_privileges();
call mysql.mysql_cluster_restore_local_privileges();