diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-11-24 14:13:41 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-12-12 00:31:44 +0100 |
commit | 4abb8216a054e14afbeb81e8529e02bab6fa14ac (patch) | |
tree | a2e0d28a19ab222edf6bf2e68c26a6df14db05a6 /mysql-test/main | |
parent | d68d7e50f928f7966f21524b4247a0a54d09a6d1 (diff) | |
download | mariadb-git-4abb8216a054e14afbeb81e8529e02bab6fa14ac.tar.gz |
MDEV-17658 change the structure of mysql.user table
Implement User_table_json.
Fix scripts to use mysql.global_priv.
Fix tests.
Diffstat (limited to 'mysql-test/main')
82 files changed, 498 insertions, 842 deletions
diff --git a/mysql-test/main/1st.result b/mysql-test/main/1st.result index 2d49726c5f6..c630be1d61c 100644 --- a/mysql-test/main/1st.result +++ b/mysql-test/main/1st.result @@ -13,6 +13,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result index 68720b6d6c7..cc3c4a43ffe 100644 --- a/mysql-test/main/alter_user.result +++ b/mysql-test/main/alter_user.result @@ -1,3 +1,4 @@ +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'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000 @@ -51,15 +52,15 @@ Note 1396 Operation ALTER USER failed for 'boo' alter user foo identified by 'something'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something2'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *9CD58369E930E28C8996A89DB18B63294E6DC10C N N 0.000000 +% foo *9CD58369E930E28C8996A89DB18B63294E6DC10C N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *9CD58369E930E28C8996A89DB18B63294E6DC10C N N 0.000000 alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified with 'somecoolplugin'; ERROR HY000: Operation ALTER USER failed for 'foo'@'%' show warnings; @@ -73,21 +74,21 @@ Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv D alter user foo identified with 'mysql_old_password' using '0123456789ABCDEF'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password 0123456789ABCDEF N N 0.000000 +% foo 0123456789ABCDEF N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password 0123456789ABCDEF N N 0.000000 # Test ssl related altering. alter user foo identified by 'something' require SSL; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something' require X509; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something' require cipher 'text' issuer 'foo_issuer' subject 'foo_subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 # Test resource limits altering. alter user foo with MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 @@ -95,6 +96,6 @@ MAX_CONNECTIONS_PER_HOUR 30 MAX_USER_CONNECTIONS 40; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 drop user foo; -update mysql.user set plugin=''; +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test index ef20f79a554..9ea98615272 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -1,5 +1,7 @@ --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 # @@ -82,4 +84,4 @@ alter user foo with MAX_QUERIES_PER_HOUR 10 select * from mysql.user where user = 'foo'; drop user foo; -update mysql.user set plugin=''; +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/auth_rpl.result b/mysql-test/main/auth_rpl.result index a3da7985da1..56f5f5e8f2b 100644 --- a/mysql-test/main/auth_rpl.result +++ b/mysql-test/main/auth_rpl.result @@ -15,7 +15,7 @@ connection master; connection slave; # Slave in-sync with master now. SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; -user plugin authentication_string +User plugin authentication_string plug_user test_plugin_server plug_user # Cleanup (on slave). include/stop_slave.inc diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index c52c9edd578..459ec286165 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -1,5 +1,4 @@ SET global secure_auth=0; -drop table if exists t1,t2; connect con1,localhost,root,,mysql; show tables; Tables_in_mysql @@ -9,6 +8,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -56,6 +56,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -114,6 +115,7 @@ db event func general_log +global_priv_bak gtid_slave_pos help_category help_keyword @@ -138,6 +140,7 @@ time_zone_transition time_zone_transition_type transaction_registry user +user_bak connect con6,localhost,test,gambling3,test; show tables; Tables_in_test @@ -158,7 +161,6 @@ connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) delete from mysql.user where user=_binary"test"; -flush privileges; connect con7,localhost,root,,test; create table t1 (id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key); @@ -358,8 +360,8 @@ update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user where user like 'mysqltest_up_'; user password plugin authentication_string -mysqltest_up1 mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB -mysqltest_up2 mysql_old_password 09301740536db389 +mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB +mysqltest_up2 09301740536db389 mysql_old_password 09301740536db389 flush privileges; connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,; select user(), current_user(); @@ -383,7 +385,6 @@ drop table t1; create table t1 (col1 int); alter table t1 add via int not null; drop table t1; -drop procedure if exists p1; create procedure p1(x int) foo: loop if x = 0 then diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index b46913c3cb4..afc0fcc1259 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -14,10 +14,6 @@ SET global secure_auth=0; ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - #connect (con1,localhost,root,,""); #show tables; connect (con1,localhost,root,,mysql); @@ -66,6 +62,7 @@ connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,); # check if old password version also works +source include/switch_to_mysql_user.inc; update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test"; flush privileges; @@ -97,11 +94,10 @@ connect (fail_con,localhost,test,zorro,test2); --error ER_ACCESS_DENIED_ERROR connect (fail_con,localhost,test,zorro,); - +source include/switch_to_mysql_global_priv.inc; # remove user 'test' so that other tests which may use 'test' # do not depend on this test. delete from mysql.user where user=_binary"test"; -flush privileges; # # Bug#12517 Clear user variables and replication events before @@ -403,6 +399,7 @@ connection default; # # cannot connect when password is set and plugin=mysql_native_password # +source include/switch_to_mysql_user.inc; update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1'; update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user @@ -418,13 +415,14 @@ select user(), current_user(); disconnect pcon7; connection default; +source include/switch_to_mysql_global_priv.inc; + DROP USER mysqltest_up1@'%'; DROP USER mysqltest_up2@'%'; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc - --echo # --echo # BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore --echo # @@ -436,10 +434,6 @@ create table t1 (col1 int); alter table t1 add via int not null; drop table t1; ---disable_warnings -drop procedure if exists p1; ---enable_warnings - delimiter |; create procedure p1(x int) foo: loop @@ -454,6 +448,4 @@ delimiter ;| call p1(2); drop procedure p1; - - SET global secure_auth=default; diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result index bd10c6aba3b..8bd0ca88335 100644 --- a/mysql-test/main/create_user.result +++ b/mysql-test/main/create_user.result @@ -6,45 +6,45 @@ drop user foo; create user foo identified by 'password'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require SSL; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require X509; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require ISSUER 'issuer'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require SUBJECT 'subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher' SUBJECT 'subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher' AND SUBJECT 'subject' AND ISSUER 'issuer'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo, foo2 identified by 'password' require CIPHER 'cipher' AND SUBJECT 'subject' diff --git a/mysql-test/main/ctype_upgrade.result b/mysql-test/main/ctype_upgrade.result index 7f8b594cbf8..9d19c3b5203 100644 --- a/mysql-test/main/ctype_upgrade.result +++ b/mysql-test/main/ctype_upgrade.result @@ -235,6 +235,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -257,9 +258,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -293,6 +294,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -315,9 +317,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/empty_user_table.result b/mysql-test/main/empty_user_table.result index 54a7fd4907b..924e4cd8ea5 100644 --- a/mysql-test/main/empty_user_table.result +++ b/mysql-test/main/empty_user_table.result @@ -1,9 +1,14 @@ -create table t1 as select * from mysql.user; -truncate table mysql.user; +create table t1 as select * from mysql.global_priv; +truncate table mysql.global_priv; flush privileges; connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u1; Got one of the listed errors -insert mysql.user select * from t1; +insert mysql.global_priv select * from t1; drop table t1; flush privileges; +truncate table mysql.user; +flush privileges; +connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); +connect fail,localhost,u1; +Got one of the listed errors diff --git a/mysql-test/main/empty_user_table.test b/mysql-test/main/empty_user_table.test index b54f2109e30..8a544fece83 100644 --- a/mysql-test/main/empty_user_table.test +++ b/mysql-test/main/empty_user_table.test @@ -4,8 +4,8 @@ source include/not_embedded.inc; -create table t1 as select * from mysql.user; -truncate table mysql.user; +create table t1 as select * from mysql.global_priv; +truncate table mysql.global_priv; flush privileges; # connecting via unix socket gives ER_ACCESS_DENIED_ERROR @@ -14,7 +14,23 @@ flush privileges; --error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED connect (fail,localhost,u1); -insert mysql.user select * from t1; +insert mysql.global_priv select * from t1; drop table t1; flush privileges; +# +# same with mysql.user +# + +source include/switch_to_mysql_user.inc; +truncate table mysql.user; + +flush privileges; + +# connecting via unix socket gives ER_ACCESS_DENIED_ERROR +# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED +connect (fail,localhost,u1); + +source include/switch_to_mysql_global_priv.inc; diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result index 5a6b9f841c2..51414d0c196 100644 --- a/mysql-test/main/explain_non_select.result +++ b/mysql-test/main/explain_non_select.result @@ -229,7 +229,7 @@ INSERT INTO t1 VALUES (1),(2); EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE user index NULL PRIMARY 420 NULL 4 Using index +1 SIMPLE global_priv index NULL PRIMARY 420 NULL 4 Using index DROP TABLE t1; DROP VIEW v1; # diff --git a/mysql-test/main/failed_auth_3909.result b/mysql-test/main/failed_auth_3909.result index bc82492c9ed..19951415585 100644 --- a/mysql-test/main/failed_auth_3909.result +++ b/mysql-test/main/failed_auth_3909.result @@ -1,13 +1,6 @@ -optimize table mysql.user; -Table Op Msg_type Msg_text -mysql.user optimize status OK -insert ignore mysql.user (user,plugin) values ('foo','mysql_old_password'),('bar','mysql_old_password'),('baz','mysql_old_password'); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value -flush privileges; +create user foo identified via mysql_old_password; +create user bar identified via mysql_old_password; +create user baz identified via mysql_old_password; connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u1; ERROR 28000: Access denied for user 'u1'@'localhost' (using password: NO) diff --git a/mysql-test/main/failed_auth_3909.test b/mysql-test/main/failed_auth_3909.test index 45267d628b2..25e45e49a0e 100644 --- a/mysql-test/main/failed_auth_3909.test +++ b/mysql-test/main/failed_auth_3909.test @@ -6,9 +6,9 @@ source include/not_embedded.inc; # verify that for some failed login attemps (with wrong user names) # the server requests a plugin # -optimize table mysql.user; -insert ignore mysql.user (user,plugin) values ('foo','mysql_old_password'),('bar','mysql_old_password'),('baz','mysql_old_password'); -flush privileges; +create user foo identified via mysql_old_password; +create user bar identified via mysql_old_password; +create user baz identified via mysql_old_password; --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR diff --git a/mysql-test/main/failed_auth_unixsocket.result b/mysql-test/main/failed_auth_unixsocket.result index 3b2cff7e845..b2081c9ba84 100644 --- a/mysql-test/main/failed_auth_unixsocket.result +++ b/mysql-test/main/failed_auth_unixsocket.result @@ -1,4 +1,4 @@ -update mysql.user set plugin='unix_socket'; +update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket'); flush privileges; Warnings: Warning 1524 Plugin 'unix_socket' is not loaded @@ -13,6 +13,6 @@ flush privileges; connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'USER'@'localhost' ERROR 28000: Access denied for user 'USER'@'localhost' -update mysql.user set plugin=''; +update mysql.global_priv set priv=json_remove(priv, '$.plugin'); flush privileges; uninstall plugin unix_socket; diff --git a/mysql-test/main/failed_auth_unixsocket.test b/mysql-test/main/failed_auth_unixsocket.test index 5dfd9585882..179e561e9ed 100644 --- a/mysql-test/main/failed_auth_unixsocket.test +++ b/mysql-test/main/failed_auth_unixsocket.test @@ -4,7 +4,7 @@ # MDEV-3909 remote user enumeration # unix_socket tests # -update mysql.user set plugin='unix_socket'; +update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket'); flush privileges; # Make sure that the replace works, even if $USER is 'user' or something else @@ -36,7 +36,7 @@ connect (fail,localhost,$USER); --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR change_user $USER; -update mysql.user set plugin=''; +update mysql.global_priv set priv=json_remove(priv, '$.plugin'); flush privileges; uninstall plugin unix_socket; diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 50a2544f2ae..46d87a4777f 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -2,6 +2,7 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; drop table if exists t1; drop database if exists mysqltest; connect master,localhost,root,,; @@ -298,12 +299,7 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES select 1; 1 1 -insert into mysql.user (host, user) values ('localhost', 'test11'); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +insert into mysql.global_priv (host, user) values ('localhost', 'test11'); insert into mysql.db (host, db, user, select_priv) values ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); alter table mysql.db order by db asc; @@ -842,9 +838,6 @@ drop database db27515; End of 4.1 tests use test; create table t1 (a int); -create table t2 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; create user mysqltest_8@''; create user mysqltest_8@host8; create user mysqltest_8@''; @@ -854,7 +847,7 @@ ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%' create user mysqltest_8@host8; ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8' select user, QUOTE(host) from mysql.user where user="mysqltest_8"; -user QUOTE(host) +User QUOTE(host) mysqltest_8 '%' mysqltest_8 'host8' Schema privileges @@ -1044,9 +1037,6 @@ ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' drop user mysqltest_8@host8; show grants for mysqltest_8@host8; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8' -insert into mysql.user select * from t2; -flush privileges; -drop table t2; drop table t1; connection master; CREATE DATABASE mysqltest3; @@ -1453,7 +1443,6 @@ CURRENT_USER() root@localhost SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); -update mysql.user set plugin=''; # Bug#57952 @@ -1925,7 +1914,7 @@ DROP DATABASE db2; grant usage on Foo.* to myuser@Localhost identified by 'foo'; grant select on Foo.* to myuser@localhost; select host,user from mysql.user where User='myuser'; -host user +Host User localhost myuser revoke select on Foo.* from myuser@localhost; delete from mysql.user where User='myuser'; @@ -2733,7 +2722,7 @@ DROP USER untrusted@localhost; DROP DATABASE secret; set GLOBAL sql_mode=default; # -# Start of 10.2 tests +# End of 10.1 tests # # # MDEV-10134 Add full support for DEFAULT @@ -2779,3 +2768,7 @@ RENAME USER '' TO 'name'; GRANT UPDATE ON test.* TO foo; RENAME USER 'name' to ''; DROP USER foo; +# +# End of 10.4 tests +# +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index 0e09761db36..8ae64c9ad4d 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -10,6 +10,7 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; # Cleanup --disable_warnings @@ -131,7 +132,7 @@ select 1; # To test that the previous command didn't cause problems # # Bug#4898 User privileges depending on ORDER BY Settings of table db # -insert into mysql.user (host, user) values ('localhost', 'test11'); +insert into mysql.global_priv (host, user) values ('localhost', 'test11'); insert into mysql.db (host, db, user, select_priv) values ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); alter table mysql.db order by db asc; @@ -581,12 +582,6 @@ drop database db27515; use test; create table t1 (a int); -# Backup anonymous users and remove them. (They get in the way of -# the one we test with here otherwise.) -create table t2 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; - # Create some users with different hostnames create user mysqltest_8@''; create user mysqltest_8@host8; @@ -700,10 +695,6 @@ drop user mysqltest_8@host8; --error ER_NONEXISTING_GRANT show grants for mysqltest_8@host8; -# Restore the anonymous users. -insert into mysql.user select * from t2; -flush privileges; -drop table t2; drop table t1; # @@ -1265,9 +1256,6 @@ SELECT CURRENT_USER(); SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); -#cleanup after MDEV-16238 -update mysql.user set plugin=''; - # # Bug#57952: privilege change is not taken into account by EXECUTE. # @@ -2233,7 +2221,7 @@ set GLOBAL sql_mode=default; --source include/wait_until_count_sessions.inc --echo # ---echo # Start of 10.2 tests +--echo # End of 10.1 tests --echo # --echo # @@ -2278,3 +2266,8 @@ GRANT UPDATE ON test.* TO foo; RENAME USER 'name' to ''; DROP USER foo; +--echo # +--echo # End of 10.4 tests +--echo # + +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/grant2.result b/mysql-test/main/grant2.result index 4fd1a6c3fe7..5d168a04455 100644 --- a/mysql-test/main/grant2.result +++ b/mysql-test/main/grant2.result @@ -1,3 +1,4 @@ +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -182,10 +183,10 @@ grant insert on test.* to 'mysqltest_2'; grant update on test.t1 to 'mysqltest_2'; grant update (c2) on test.t2 to 'mysqltest_2'; select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; -host user password plugin authentication_string +Host User Password plugin authentication_string % mysqltest_1 mysql_native_password -% mysqltest_2 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff +% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff select host,db,user from mysql.db where user like 'mysqltest_%'; host db user % test mysqltest_2 @@ -207,9 +208,9 @@ GRANT UPDATE (c2) ON "test"."t2" TO 'mysqltest_2'@'%' GRANT UPDATE ON "test"."t1" TO 'mysqltest_2'@'%' drop user 'mysqltest_1'; select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; -host user password plugin authentication_string -% mysqltest_2 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff +Host User Password plugin authentication_string +% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff select host,db,user from mysql.db where user like 'mysqltest_%'; host db user % test mysqltest_2 @@ -224,9 +225,9 @@ show grants for 'mysqltest_1'; ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' rename user 'mysqltest_2' to 'mysqltest_1'; select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; -host user password plugin authentication_string -% mysqltest_1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 mysql_native_password fffffffffffffffffffffffffffffffffffffffff +Host User Password plugin authentication_string +% mysqltest_1 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff select host,db,user from mysql.db where user like 'mysqltest_%' ; host db user % test mysqltest_1 @@ -328,12 +329,7 @@ GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' GRANT INSERT, UPDATE, DELETE ON `mysql`.* TO 'mysqltest_3'@'localhost' select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 'user' -insert into mysql.user set host='%', user='mysqltest_B'; -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +insert into mysql.global_priv set host='%', user='mysqltest_B'; create user mysqltest_A@'%'; rename user mysqltest_B@'%' to mysqltest_C@'%'; drop user mysqltest_C@'%'; @@ -373,7 +369,7 @@ set password = password('changed'); disconnect b12302; connection default; select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1'; -host length(authentication_string) +Host length(authentication_string) 127.0.0.1 41 revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1'; delete from mysql.user where user like 'mysqltest\_1'; @@ -388,7 +384,7 @@ set password = password('changed'); disconnect b12302_2; connection default; select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1'; -host length(authentication_string) +Host length(authentication_string) 127.0.0.0/255.0.0.0 41 revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0'; delete from mysql.user where user like 'mysqltest\_1'; @@ -428,15 +424,10 @@ disconnect con2root; disconnect con3root; create database TESTDB; create table t2(a int); -create temporary table t1 as select * from mysql.user; -delete from mysql.user where host='localhost'; -INSERT INTO mysql.user (host, user, password) VALUES -('%','mysqltest_1',password('password')); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +create temporary table t1 as select * from mysql.global_priv; +delete from mysql.global_priv where host='localhost'; +INSERT INTO mysql.global_priv (host, user, priv) VALUES +('%','mysqltest_1',json_object('authentication_string', password('password'))); INSERT INTO mysql.db (host, db, user, select_priv) VALUES ('%','TESTDB','mysqltest_1','Y'); FLUSH PRIVILEGES; @@ -445,9 +436,9 @@ create database TEStdb; Got one of the listed errors connection default; disconnect con1; -delete from mysql.user; +delete from mysql.global_priv; delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB'; -insert into mysql.user select * from t1; +insert into mysql.global_priv select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; @@ -556,25 +547,17 @@ USE mysql; SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -user host password plugin authentication_string insert_priv +User Host Password plugin authentication_string Insert_priv root localhost Y -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; -SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -user host password plugin authentication_string insert_priv -root localhost N GRANT INSERT ON *.* TO CURRENT_USER(); SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -user host password plugin authentication_string insert_priv +User Host Password plugin authentication_string Insert_priv root localhost mysql_native_password Y -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose'; SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -user host password plugin authentication_string insert_priv -root localhost mysql_native_password *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y -UPDATE user SET plugin='', authentication_string='' WHERE user=@u AND host=@h; -SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -user host password plugin authentication_string insert_priv -root localhost Y +User Host Password plugin authentication_string Insert_priv +root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB mysql_native_password *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y +UPDATE global_priv SET priv=@root_priv; FLUSH PRIVILEGES; USE test; End of 5.1 tests diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index f0b58da4cb5..b33d7d63992 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -4,7 +4,7 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc - +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -361,7 +361,7 @@ connection user4; show grants; --error ER_TABLEACCESS_DENIED_ERROR select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; -insert into mysql.user set host='%', user='mysqltest_B'; +insert into mysql.global_priv set host='%', user='mysqltest_B'; create user mysqltest_A@'%'; rename user mysqltest_B@'%' to mysqltest_C@'%'; drop user mysqltest_C@'%'; @@ -481,10 +481,10 @@ disconnect con3root; create database TESTDB; create table t2(a int); -create temporary table t1 as select * from mysql.user; -delete from mysql.user where host='localhost'; -INSERT INTO mysql.user (host, user, password) VALUES -('%','mysqltest_1',password('password')); +create temporary table t1 as select * from mysql.global_priv; +delete from mysql.global_priv where host='localhost'; +INSERT INTO mysql.global_priv (host, user, priv) VALUES +('%','mysqltest_1',json_object('authentication_string', password('password'))); INSERT INTO mysql.db (host, db, user, select_priv) VALUES ('%','TESTDB','mysqltest_1','Y'); FLUSH PRIVILEGES; @@ -500,9 +500,9 @@ create database TEStdb; # Clean-up connection default; disconnect con1; -delete from mysql.user; +delete from mysql.global_priv; delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB'; -insert into mysql.user select * from t1; +insert into mysql.global_priv select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; @@ -661,22 +661,15 @@ SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; # show current privs. SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -# toggle INSERT -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; -SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; - # show that GRANT ... TO CURRENT_USER() no longer crashes GRANT INSERT ON *.* TO CURRENT_USER(); SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; # show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose'; SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; -UPDATE user SET plugin='', authentication_string='' WHERE user=@u AND host=@h; -SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; - +UPDATE global_priv SET priv=@root_priv; FLUSH PRIVILEGES; USE test; diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result index 4c99fb02f19..1bc6e7572c5 100644 --- a/mysql-test/main/grant3.result +++ b/mysql-test/main/grant3.result @@ -29,7 +29,7 @@ grant select on test.* to CUser@localhost; grant select on test.* to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv @@ -37,14 +37,14 @@ CUser localhost test Y REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv @@ -56,7 +56,7 @@ grant select on test.t1 to CUser@localhost; grant select on test.t1 to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -64,14 +64,14 @@ CUser localhost test t1 Select REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -82,7 +82,7 @@ grant select(a) on test.t1 to CUser@localhost; grant select(a) on test.t1 to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -90,14 +90,14 @@ CUser localhost test t1 Select REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -109,7 +109,7 @@ grant select on test.* to CUser2@localhost; grant select on test.* to CUser2@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv @@ -117,7 +117,7 @@ CUser2 localhost test Y REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv @@ -125,7 +125,7 @@ REVOKE SELECT ON test.* FROM 'CUser2'@'localhost'; ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost' flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index 735b8260fce..9aad70205ec 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -198,15 +198,15 @@ grant select on test.* to foo6 identified by password '2222222222222222'; grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111'; grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222'; select user,password,plugin,authentication_string from mysql.user where user like 'foo%'; -user password plugin authentication_string -foo1 mysql_native_password 11111111111111111111111111111111111111111 -foo2 mysql_old_password 2222222222222222 -foo3 mysql_native_password 11111111111111111111111111111111111111111 -foo4 mysql_old_password 2222222222222222 -foo5 mysql_native_password 11111111111111111111111111111111111111111 -foo6 mysql_old_password 2222222222222222 -foo7 mysql_native_password 11111111111111111111111111111111111111111 -foo8 mysql_old_password 2222222222222222 +User Password plugin authentication_string +foo1 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo2 2222222222222222 mysql_old_password 2222222222222222 +foo3 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo4 2222222222222222 mysql_old_password 2222222222222222 +foo5 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo6 2222222222222222 mysql_old_password 2222222222222222 +foo7 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo8 2222222222222222 mysql_old_password 2222222222222222 drop user foo1; drop user foo2; drop user foo3; diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index af7b75277b8..5df4a669a0c 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -38,19 +38,19 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number set password for u7@h = old_password('pwd'); create user u8@h identified with 'mysql_old_password'; set password for u8@h = '78a302dd267f6044'; -select user,host,password,plugin,authentication_string from mysql.user where host='h'; -user host password plugin authentication_string -u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD -u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD -u3 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD -u4 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD -u5 h mysql_old_password 78a302dd267f6044 -u6 h mysql_old_password 78a302dd267f6044 -u7 h mysql_old_password 78a302dd267f6044 -u8 h mysql_old_password 78a302dd267f6044 -update mysql.user set authentication_string='bad' where user='u1'; -update mysql.user set authentication_string='bad' where user='u5'; -update mysql.user set plugin='nonexistent' where user='u8'; +select user,host,plugin,authentication_string from mysql.user where host='h'; +User Host plugin authentication_string +u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u3 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u4 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u5 h mysql_old_password 78a302dd267f6044 +u6 h mysql_old_password 78a302dd267f6044 +u7 h mysql_old_password 78a302dd267f6044 +u8 h mysql_old_password 78a302dd267f6044 +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1'; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8'; flush privileges; Warnings: Error 1372 Password hash should be a 41-digit hexadecimal number @@ -89,7 +89,7 @@ grant select on *.* to u7@h; grant select on *.* to u8@h; ERROR 28000: Can't find any matching row in the user table select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; -user select_priv plugin authentication_string +User Select_priv plugin authentication_string u1 N mysql_native_password bad u2 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD u3 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 1ab68b82066..4e89bad9775 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -49,11 +49,11 @@ set password for u7@h = old_password('pwd'); create user u8@h identified with 'mysql_old_password'; eval set password for u8@h = '$p'; sorted_result; -select user,host,password,plugin,authentication_string from mysql.user where host='h'; +select user,host,plugin,authentication_string from mysql.user where host='h'; # test with invalid entries -update mysql.user set authentication_string='bad' where user='u1'; -update mysql.user set authentication_string='bad' where user='u5'; -update mysql.user set plugin='nonexistent' where user='u8'; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1'; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8'; flush privileges; # invalid entries are skipped, users don't exist error ER_PASSWORD_NO_MATCH; diff --git a/mysql-test/main/grant_4332.result b/mysql-test/main/grant_4332.result index b62ca1a20cc..af6b23088f5 100644 --- a/mysql-test/main/grant_4332.result +++ b/mysql-test/main/grant_4332.result @@ -1,5 +1,5 @@ -set GLOBAL sql_mode=""; -set LOCAL sql_mode=""; +set global sql_mode=""; +set local sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; alter table mysql.db modify User char(16) binary not null default ''; alter table mysql.tables_priv modify User char(16) binary not null default ''; @@ -32,4 +32,4 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def user() 253 141 14 N 1 39 8 user() root@localhost -set GLOBAL sql_mode=default; +set global sql_mode=default; diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 41e0b822f98..f723e4afe44 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -6,8 +6,9 @@ # --source include/not_embedded.inc -set GLOBAL sql_mode=""; -set LOCAL sql_mode=""; +--source include/switch_to_mysql_user.inc +set global sql_mode=""; +set local sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; alter table mysql.db modify User char(16) binary not null default ''; @@ -42,4 +43,5 @@ flush privileges; select user(); --disable_metadata -set GLOBAL sql_mode=default; +set global sql_mode=default; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index 6db839edf51..b76d9f64a9f 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -96,6 +96,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -563,6 +564,7 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; select * from information_schema.views; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysql user select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED @@ -593,6 +595,7 @@ information_schema.tables; s1 10 11 +NULL drop table t1; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table @@ -824,7 +827,7 @@ NULL select table_type from information_schema.tables where table_schema="mysql" and table_name="user"; table_type -BASE TABLE +VIEW show open tables where `table` like "user"; Database Table In_use Name_locked mysql user 0 0 @@ -874,6 +877,14 @@ information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION +mysql global_priv Priv +mysql user Password +mysql user ssl_cipher +mysql user x509_issuer +mysql user x509_subject +mysql user plugin +mysql user authentication_string +mysql user default_role select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%' order by binary table_name, ordinal_position; @@ -1253,7 +1264,7 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE f3 = (SELECT func2 ()); SELECT func1(); func1() -1 +2 DROP TABLE t1; DROP VIEW v1; DROP FUNCTION func1; @@ -1404,6 +1415,7 @@ create table t2 (f1 int, f2 int); create view v2 as select f1+1 as a, f2 as b from t2; select table_name, is_updatable from information_schema.views order by table_name; table_name is_updatable +user YES v1 NO v2 YES delete from v1; @@ -1959,7 +1971,7 @@ connection con1; flush tables; flush tables t1; connection default; -select * from information_schema.views; +select * from information_schema.views where table_schema='test'; TABLE_CATALOG def TABLE_SCHEMA test TABLE_NAME v1 diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index 7ce6437d610..95b6f253058 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -1631,7 +1631,7 @@ let $wait_condition= info = "flush tables t1"; --source include/wait_condition.inc --vertical_results -select * from information_schema.views; +select * from information_schema.views where table_schema='test'; --horizontal_results unlock tables; diff --git a/mysql-test/main/information_schema_all_engines.result b/mysql-test/main/information_schema_all_engines.result index 0ce9f15f753..2916858b5a6 100644 --- a/mysql-test/main/information_schema_all_engines.result +++ b/mysql-test/main/information_schema_all_engines.result @@ -460,4 +460,4 @@ Wildcard: inf_rmation_schema SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) information_schema 65 -mysql 30 +mysql 31 diff --git a/mysql-test/main/init_file_set_password-7656.result b/mysql-test/main/init_file_set_password-7656.result index 99a16a395d7..fba65b036fd 100644 --- a/mysql-test/main/init_file_set_password-7656.result +++ b/mysql-test/main/init_file_set_password-7656.result @@ -1,8 +1,8 @@ create user foo@localhost; select user,host,password from mysql.user where user='foo'; -user host password +User Host Password foo localhost select user,host,password,plugin,authentication_string from mysql.user where user='foo'; -user host password plugin authentication_string -foo localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +User Host Password plugin authentication_string +foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 drop user foo@localhost; diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index b3e47708140..7918cb173e9 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -755,10 +755,10 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause' select statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT -from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user'; +from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv'; TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT -user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI -user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI +global_priv Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +global_priv User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI Warnings: Warning 1286 Unknown storage engine 'InnoDB' Warning 1286 Unknown storage engine 'InnoDB' diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index 3d2a02e2346..a6cf2dcc217 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -555,7 +555,7 @@ select * from v1a join v1b on t1.b = t2.b; select statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT - from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user'; + from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv'; drop table t1; drop table t2; diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 79a4bf9730d..dcada9b60e2 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -6033,12 +6033,12 @@ drop table t1; SET join_cache_level = 3; # The following should have # - table order PROFILING,user, -# - table user accessed with hash_ALL: +# - table db accessed with hash_ALL: explain -SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR; +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where -1 SIMPLE user hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 4 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE db hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join) set join_cache_level=default; create table t1 (c1 date not null, key (c1)) engine=innodb; insert t1 values ('2017-12-27'); diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index df89fc30dee..046dcfcf3cb 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -3970,9 +3970,9 @@ drop table t1; SET join_cache_level = 3; --echo # The following should have --echo # - table order PROFILING,user, ---echo # - table user accessed with hash_ALL: +--echo # - table db accessed with hash_ALL: explain -SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR; +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; set join_cache_level=default; diff --git a/mysql-test/main/lock_multi.result b/mysql-test/main/lock_multi.result index 5441ba1ecb4..30cd63e60ed 100644 --- a/mysql-test/main/lock_multi.result +++ b/mysql-test/main/lock_multi.result @@ -118,17 +118,17 @@ LOCK TABLES columns_priv WRITE, db WRITE, user WRITE; FLUSH TABLES; connection reader; USE mysql; -SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; +SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1; connection locker; -OPTIMIZE TABLES columns_priv, db, user; +OPTIMIZE TABLES columns_priv, db, global_priv; Table Op Msg_type Msg_text mysql.columns_priv optimize status OK mysql.db optimize status OK -mysql.user optimize status OK +mysql.global_priv optimize status OK UNLOCK TABLES; connection reader; -Select_priv -N +host +localhost USE test; connection locker; use test; diff --git a/mysql-test/main/lock_multi.test b/mysql-test/main/lock_multi.test index 59c6978cb5a..5cc7219b01d 100644 --- a/mysql-test/main/lock_multi.test +++ b/mysql-test/main/lock_multi.test @@ -191,18 +191,18 @@ connection reader; USE mysql; # Note: This must be a multi-table select, otherwise the deadlock will not occur send -SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; +SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1; # connection locker; # Sleep a bit till the select of connection reader is in work and hangs let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock" AND info = - "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1"; + "SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1"; --source include/wait_condition.inc # Make test case independent from earlier grants. --replace_result "Table is already up to date" "OK" -OPTIMIZE TABLES columns_priv, db, user; +OPTIMIZE TABLES columns_priv, db, global_priv; UNLOCK TABLES; # connection reader; diff --git a/mysql-test/main/log_tables_upgrade.result b/mysql-test/main/log_tables_upgrade.result index df6ea72f3ca..8d7b08a11bd 100644 --- a/mysql-test/main/log_tables_upgrade.result +++ b/mysql-test/main/log_tables_upgrade.result @@ -19,6 +19,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -42,9 +43,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/lowercase_fs_off.result b/mysql-test/main/lowercase_fs_off.result index e05fd50caeb..6ff8c1b7f93 100644 --- a/mysql-test/main/lowercase_fs_off.result +++ b/mysql-test/main/lowercase_fs_off.result @@ -94,6 +94,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -122,7 +123,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -136,6 +136,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/mdl.result b/mysql-test/main/mdl.result index 187d885f29c..883f35674c0 100644 --- a/mysql-test/main/mdl.result +++ b/mysql-test/main/mdl.result @@ -45,6 +45,7 @@ MDL_BACKUP_DDL Backup lock MDL_SHARED_NO_READ_WRITE Table metadata lock mysql user MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 MDL_INTENTION_EXCLUSIVE Schema metadata lock mysql +MDL_SHARED_NO_READ_WRITE Table metadata lock mysql global_priv MDL_INTENTION_EXCLUSIVE Schema metadata lock test UNLOCK TABLES; LOCK TABLES mysql.general_log WRITE; diff --git a/mysql-test/main/mysql_upgrade-6984.result b/mysql-test/main/mysql_upgrade-6984.result index a7b5bcb86bf..87f3c1a5359 100644 --- a/mysql-test/main/mysql_upgrade-6984.result +++ b/mysql-test/main/mysql_upgrade-6984.result @@ -1,4 +1,4 @@ -update mysql.user set password=password("foo") where user='root'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')); Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -7,6 +7,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -49,6 +49,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -62,6 +63,6 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK connect con1,localhost,root,foo,,,; -update mysql.user set password='' where user='root'; +update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string'); flush privileges; set global event_scheduler=OFF; diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test index 9bbfbeb3f87..a036b7a08a0 100644 --- a/mysql-test/main/mysql_upgrade-6984.test +++ b/mysql-test/main/mysql_upgrade-6984.test @@ -11,13 +11,13 @@ # In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES # -update mysql.user set password=password("foo") where user='root'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')); --exec $MYSQL_UPGRADE connect(con1,localhost,root,foo,,,); -update mysql.user set password='' where user='root'; +update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string'); flush privileges; # Load event table set global event_scheduler=OFF; diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 55eefda693b..a99895f53d7 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -8,6 +8,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -30,9 +31,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -56,6 +57,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -78,9 +80,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -104,6 +106,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -126,9 +129,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -157,6 +160,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -179,9 +183,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -211,6 +215,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -233,9 +238,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -268,6 +273,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -290,9 +296,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -320,6 +326,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -342,7 +349,6 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views... Skipped Phase 4/7: Running 'mysql_fix_privilege_tables' @@ -364,6 +370,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -386,9 +393,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -429,6 +436,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -451,9 +459,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -511,6 +519,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -533,9 +542,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -566,7 +575,7 @@ Start of 10.3 tests # Ensure that mysql_upgrade correctly sets truncate_versioning_priv # on upgrade from 10.2 # -flush privileges; +drop view mysql.user_bak; CREATE USER 'user3'@'%'; GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; @@ -580,3 +589,5 @@ GRANT USAGE ON *.* TO 'user3'@'%' GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' DROP USER 'user3'@'%'; update mysql.db set Delete_history_priv='Y' where db like 'test%'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 0171fe6c7ba..d4a3d864c21 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -227,7 +227,8 @@ SET GLOBAL enforce_storage_engine=NULL; --echo # on upgrade from 10.2 --echo # -flush privileges; +--source include/switch_to_mysql_user.inc +drop view mysql.user_bak; CREATE USER 'user3'@'%'; GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; @@ -241,3 +242,5 @@ flush privileges; SHOW GRANTS FOR 'user3'@'%'; DROP USER 'user3'@'%'; update mysql.db set Delete_history_priv='Y' where db like 'test%'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_no_innodb.result b/mysql-test/main/mysql_upgrade_no_innodb.result index 90e96800bff..35b55bb45e0 100644 --- a/mysql-test/main/mysql_upgrade_no_innodb.result +++ b/mysql-test/main/mysql_upgrade_no_innodb.result @@ -7,6 +7,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result index 5dfe8aeb289..79ad04e1849 100644 --- a/mysql-test/main/mysql_upgrade_noengine.result +++ b/mysql-test/main/mysql_upgrade_noengine.result @@ -1,3 +1,4 @@ +drop view mysql.user_bak; install soname 'ha_blackhole'; install soname 'ha_archive'; create table t1 (a int) engine=blackhole; @@ -61,6 +62,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -140,6 +142,9 @@ Warnings: Level Warning Code 1286 Message Unknown storage engine 'ARCHIVE' +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database Processing databases @@ -149,6 +154,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -228,6 +234,9 @@ Warnings: Level Warning Code 1286 Message Unknown storage engine 'ARCHIVE' +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database Processing databases @@ -237,6 +246,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -303,3 +313,5 @@ table_comment drop table t1, t2; uninstall plugin blackhole; uninstall plugin archive; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_noengine.test b/mysql-test/main/mysql_upgrade_noengine.test index 1d65e7ffa1c..e295f09eb4e 100644 --- a/mysql-test/main/mysql_upgrade_noengine.test +++ b/mysql-test/main/mysql_upgrade_noengine.test @@ -3,6 +3,8 @@ # source include/have_innodb.inc; source include/not_embedded.inc; +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; if (!$HA_BLACKHOLE_SO) { skip Need blackhole plugin; @@ -33,6 +35,11 @@ exec $MYSQL_UPGRADE 2>&1; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + # pretend it's an upgrade from 10.0 alter table mysql.user drop column default_role, drop column max_statement_time; @@ -47,6 +54,11 @@ exec $MYSQL_UPGRADE 2>&1; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + alter table mysql.user drop column default_role, drop column max_statement_time; remove_file $datadir/mysql_upgrade_info; @@ -60,3 +72,6 @@ drop table t1, t2; remove_file $datadir/mysql_upgrade_info; uninstall plugin blackhole; uninstall plugin archive; + +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_ssl.result b/mysql-test/main/mysql_upgrade_ssl.result index 6c6d0859016..ff911e9f54b 100644 --- a/mysql-test/main/mysql_upgrade_ssl.result +++ b/mysql-test/main/mysql_upgrade_ssl.result @@ -9,6 +9,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -31,9 +32,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/mysql_upgrade_view.result b/mysql-test/main/mysql_upgrade_view.result index 250e90d2b5c..d22298c6ed0 100644 --- a/mysql-test/main/mysql_upgrade_view.result +++ b/mysql-test/main/mysql_upgrade_view.result @@ -71,6 +71,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -99,7 +100,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -113,6 +113,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK test.v1 OK test.v1badcheck OK test.v2 OK @@ -220,6 +221,7 @@ mysql.db OK mysql.ev_bk OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -248,7 +250,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -262,6 +263,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views from mysql +mysql.user OK test.v1 OK test.v2 OK test.v3 OK @@ -344,6 +346,7 @@ mysql.db OK mysql.ev_bk OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -372,7 +375,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -386,6 +388,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views from mysql +mysql.user OK test.v1 OK test.v2 OK test.v3 OK diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 705683322f8..cbea1cf9def 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -61,7 +61,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #<date> server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 899 -#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -90,7 +90,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #<date> server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1214 -#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -119,7 +119,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1530 -#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -148,7 +148,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1842 -#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -177,7 +177,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 #<date> server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2134 -#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -239,7 +239,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #<date> server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2462 -#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 32 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -320,7 +320,7 @@ BEGIN #Q> DELETE FROM t1 #<date> server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2769 -#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -382,7 +382,7 @@ BEGIN #Q> DELETE FROM t2 #<date> server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3069 -#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index a030f202f45..6417a528638 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -59,7 +59,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #<date> server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 946 -#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -88,7 +88,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #<date> server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1262 -#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -117,7 +117,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1579 -#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -146,7 +146,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1892 -#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -175,7 +175,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 #<date> server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2187 -#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -237,7 +237,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2591 -#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 32 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -273,7 +273,7 @@ BEGIN #Q> DELETE FROM t1 #<date> server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2873 -#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F +#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -303,7 +303,7 @@ BEGIN #Q> DELETE FROM t2 #<date> server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3135 -#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqlcheck.result b/mysql-test/main/mysqlcheck.result index 2b4d4cb5647..063560e388e 100644 --- a/mysql-test/main/mysqlcheck.result +++ b/mysql-test/main/mysqlcheck.result @@ -9,6 +9,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -31,7 +32,6 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK mtr.global_suppressions Table is already up to date mtr.test_suppressions Table is already up to date mysql.column_stats OK @@ -39,6 +39,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -67,12 +68,12 @@ mysql.time_zone_transition_type OK mysql.transaction_registry note : Table does not support optimize, doing recreate + analyze instead status : OK -mysql.user OK mysql.column_stats OK mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -95,12 +96,12 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK mysql.column_stats Table is already up to date mysql.columns_priv Table is already up to date mysql.db Table is already up to date mysql.event Table is already up to date mysql.func Table is already up to date +mysql.global_priv Table is already up to date mysql.gtid_slave_pos Table is already up to date mysql.help_category Table is already up to date mysql.help_keyword Table is already up to date @@ -129,7 +130,6 @@ mysql.time_zone_transition_type Table is already up to date mysql.transaction_registry note : Table does not support optimize, doing recreate + analyze instead status : OK -mysql.user Table is already up to date create table t1 (a int) engine=myisam; create view v1 as select * from t1; test.t1 OK @@ -429,6 +429,7 @@ mysql.columns_priv Table is already up to date mysql.db Table is already up to date mysql.event Table is already up to date mysql.func Table is already up to date +mysql.global_priv Table is already up to date mysql.gtid_slave_pos Table is already up to date mysql.help_category Table is already up to date mysql.help_keyword Table is already up to date @@ -451,7 +452,6 @@ mysql.time_zone_name Table is already up to date mysql.time_zone_transition Table is already up to date mysql.time_zone_transition_type Table is already up to date mysql.transaction_registry OK -mysql.user Table is already up to date mysqltest1.t1 warning : Table is marked as crashed warning : Size of datafile is: 4 Should be: 0 diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index 899e0292142..7c3d029ad7d 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -362,6 +362,7 @@ uplain@localhost uplain@localhost connection default; disconnect cleartext_con; DROP USER uplain@localhost; +drop view mysql.user_bak; # # Bug #59038 : mysql.user.authentication_string column # causes configuration wizard to fail @@ -443,6 +444,8 @@ ORDER BY COLUMN_NAME; IS_NULLABLE COLUMN_NAME NO authentication_string NO plugin +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; # # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN # .-> USING PASSWORD: NO diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index c3c18b7e427..9af8f25d153 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -445,6 +445,10 @@ connection default; disconnect cleartext_con; DROP USER uplain@localhost; +# prepare for two tests that use mysql.user table +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + --echo # --echo # Bug #59038 : mysql.user.authentication_string column --echo # causes configuration wizard to fail @@ -502,7 +506,6 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='mysql' ORDER BY COLUMN_NAME; - --echo # --echo # Bug #11936829: diff. between mysql.user (authentication_string) --echo # in fresh and upgraded 5.5.11 @@ -524,7 +527,8 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS ORDER BY COLUMN_NAME; let $datadir= `select @@datadir`; remove_file $datadir/mysql_upgrade_info; - +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; --echo # --echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN diff --git a/mysql-test/main/plugin_auth_qa.result b/mysql-test/main/plugin_auth_qa.result index 2353bc80f84..e00ac1a4c96 100644 --- a/mysql-test/main/plugin_auth_qa.result +++ b/mysql-test/main/plugin_auth_qa.result @@ -1,38 +1,38 @@ set sql_mode=""; CREATE DATABASE test_user_db; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string ========== test 1.1 ====================================================== CREATE USER plug IDENTIFIED WITH test_plugin_server; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; CREATE USER plug IDENTIFIED WITH test_plugin_server AS ''; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS ''; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; @@ -100,62 +100,62 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; ========== test 1.1.1.6/1.1.2.5 ============================ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; @@ -170,12 +170,12 @@ ERROR HY000: Operation CREATE USER failed for 'plug'@'%' DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -plug mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 +User plugin authentication_string Password +plug mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug IDENTIFIED BY 'plug_dest_passwd'; @@ -184,18 +184,18 @@ DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest plug_dest test_plugin_server plug_dest DROP USER plug,plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest plug_dest test_plugin_server plug_dest DROP USER plug,plug_dest; @@ -203,23 +203,23 @@ DROP USER plug,plug_dest; SET NAMES utf8; CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER plüg; CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plüg_dest; SET NAMES ascii; CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string pl??g test_plugin_server pl??g_dest DROP USER 'plüg'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string pl??g_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; SET NAMES latin1; @@ -228,12 +228,12 @@ CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest'; ERROR HY000: Plugin 'test_plügin_server' is not loaded CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plüg_dest DROP USER 'plug'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; SET NAMES utf8; @@ -241,22 +241,22 @@ CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest'; ERROR HY000: Plugin 'test_plügin_server' is not loaded CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER 'plüg'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER plüg; CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plüg_dest; ========== test 1.1.1.2/1.1.2.2============================= @@ -271,12 +271,12 @@ CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest'; ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server hh's_plug_dest DROP USER plug; CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string hh's_plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'hh''s_plug_dest'; ========== test 1.1.1.4 ==================================== @@ -285,13 +285,13 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ========== test 1.1.3.1 ==================================== GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest; DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest plug_dest mysql_native_password DROP USER grant_user,plug_dest; @@ -299,7 +299,7 @@ set @save_sql_mode= @@sql_mode; SET @@sql_mode=no_auto_create_user; GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest; DROP USER plug_dest; @@ -308,19 +308,19 @@ ERROR 28000: Can't find any matching row in the user table DROP USER grant_user; GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password grant_user test_plugin_server plug_dest -plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password grant_user test_plugin_server plug_dest -plug_dest mysql_native_password *560881EB651416CEF77314D07D55EDCD5FC1BD6D +plug_dest mysql_native_password *560881EB651416CEF77314D07D55EDCD5FC1BD6D *560881EB651416CEF77314D07D55EDCD5FC1BD6D DROP USER grant_user,plug_dest; set @@sql_mode= @save_sql_mode; DROP DATABASE test_user_db; diff --git a/mysql-test/main/plugin_auth_qa_1.result b/mysql-test/main/plugin_auth_qa_1.result index b04483722b8..dd709fee04c 100644 --- a/mysql-test/main/plugin_auth_qa_1.result +++ b/mysql-test/main/plugin_auth_qa_1.result @@ -1,6 +1,6 @@ CREATE DATABASE test_user_db; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string ========== test 1.1.3.2 ==================================== CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; @@ -19,7 +19,7 @@ IDENTIFIED WITH test_plugin_server AS 'plug_dest'; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest 1) @@ -70,7 +70,7 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo GRANT PROXY ON new_dest TO plug_user; ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_user,new_dest; @@ -88,7 +88,7 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo GRANT PROXY ON new_dest TO plug_user; ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_user,new_dest; @@ -109,14 +109,14 @@ USER() CURRENT_USER() new_user@localhost plug_dest@% connection default; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server plug_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 disconnect plug_user; -UPDATE mysql.user SET user='plug_user' WHERE user='new_user'; +UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_dest,plug_user; @@ -132,36 +132,36 @@ plug_user@localhost plug_dest@% connection default; disconnect plug_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest -UPDATE mysql.user SET user='new_user' WHERE user='plug_user'; +UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server plug_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 -UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server new_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 -UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user'; FLUSH PRIVILEGES; Warnings: Warning 1524 Plugin 'new_plugin_server' is not loaded SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user new_plugin_server new_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 ERROR 28000: Access denied for user 'new_user'@'localhost' (using password: YES) -UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user'; -UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user'; +UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest'; FLUSH PRIVILEGES; GRANT PROXY ON new_dest TO new_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 new_user test_plugin_server new_dest connect plug_user,localhost,new_user,new_dest; @@ -170,11 +170,11 @@ USER() CURRENT_USER() new_user@localhost new_dest@% connection default; disconnect plug_user; -UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest'; +UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest'; FLUSH PRIVILEGES; CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_dest mysql_native_password *01422E86A6FFF84618914AF149F9AEF64B84170A new_user test_plugin_server new_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 @@ -190,7 +190,7 @@ DROP USER new_user,new_dest,plug_dest; CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD connect proxy_con,localhost,proxied_user,proxied_user_passwd; @@ -226,7 +226,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD connect proxy_con,localhost,proxied_user,proxied_user_passwd; @@ -268,7 +268,7 @@ GRANT PROXY ON proxied_user_3 TO ''@'%%'; GRANT PROXY ON proxied_user_4 TO ''@'%%'; GRANT PROXY ON proxied_user_5 TO ''@'%%'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user proxied_user_1 mysql_native_password *551D5A5177FCC3340F7D2FB0F4D8D1EEA7F7EF71 proxied_user_2 mysql_native_password *3D948F77C6A988AFDCA9755AB2A6724362557220 diff --git a/mysql-test/main/plugin_auth_qa_1.test b/mysql-test/main/plugin_auth_qa_1.test index 4f45a8aced6..81a9155a390 100644 --- a/mysql-test/main/plugin_auth_qa_1.test +++ b/mysql-test/main/plugin_auth_qa_1.test @@ -110,7 +110,7 @@ connection default; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; disconnect plug_user; -UPDATE mysql.user SET user='plug_user' WHERE user='new_user'; +UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -128,15 +128,15 @@ connection default; disconnect plug_user; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET user='new_user' WHERE user='plug_user'; +UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -144,8 +144,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; --error ER_ACCESS_DENIED_ERROR connect(plug_user,localhost,new_user,new_dest); --enable_query_log -UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user'; -UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user'; +UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest'; FLUSH PRIVILEGES; GRANT PROXY ON new_dest TO new_user; --sorted_result @@ -154,7 +154,7 @@ connect(plug_user,localhost,new_user,new_dest); select USER(),CURRENT_USER(); connection default; disconnect plug_user; -UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest'; +UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest'; FLUSH PRIVILEGES; CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; --sorted_result diff --git a/mysql-test/main/plugin_auth_qa_2.result b/mysql-test/main/plugin_auth_qa_2.result index ec62840ac4a..e71132e2bc9 100644 --- a/mysql-test/main/plugin_auth_qa_2.result +++ b/mysql-test/main/plugin_auth_qa_2.result @@ -6,7 +6,7 @@ CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_1_dest TO qa_test_1_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_1_user qa_auth_interface qa_test_1_dest SELECT @@proxy_user; @@ -19,7 +19,7 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_ current_user() user() @@local.proxy_user @@local.external_user qa_test_1_user@% qa_test_1_user@localhost NULL NULL SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_1_user qa_auth_interface qa_test_1_dest DROP USER qa_test_1_user; @@ -32,7 +32,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_pas GRANT PROXY ON qa_test_2_dest TO qa_test_2_user; GRANT PROXY ON authenticated_as TO qa_test_2_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_user qa_auth_interface qa_test_2_dest @@ -46,7 +46,7 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_ current_user() user() @@local.proxy_user @@local.external_user authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_user qa_auth_interface qa_test_2_dest @@ -82,9 +82,9 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_pas GRANT PROXY ON qa_test_5_dest TO qa_test_5_user; GRANT PROXY ON qa_test_5_dest TO ''@'localhost'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password - mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 -qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password + mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_5_user qa_auth_interface qa_test_5_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES) @@ -97,21 +97,21 @@ CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_6_dest TO qa_test_6_user; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password +qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES) GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password +qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) REVOKE PROXY ON qa_test_6_dest FROM root; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 @@ -120,7 +120,7 @@ DROP USER qa_test_6_user; DROP USER qa_test_6_dest; DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password === Test of the --default_auth option for clients ==== CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest'; CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd'; diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index b03f0dcbd45..9760989a736 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -2149,6 +2149,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2162,6 +2163,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2175,6 +2177,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2188,6 +2191,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2206,6 +2210,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2220,6 +2225,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2233,6 +2239,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 @@ -2246,6 +2253,7 @@ show open tables from mysql; Database Table In_use Name_locked mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 mysql index_stats 0 0 mysql table_stats 0 0 mysql user 0 0 diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result index b11d9efe080..c5c5b5a9ac0 100644 --- a/mysql-test/main/ps_ddl.result +++ b/mysql-test/main/ps_ddl.result @@ -769,11 +769,12 @@ deallocate prepare stmt; # # Test 3: View referencing an Information schema table # -create view t1 as select table_name from information_schema.views; +create view t1 as select table_name from information_schema.views order by table_name; prepare stmt from "select * from t1"; execute stmt; table_name t1 +user call p_verify_reprepare_count(0); SUCCESS @@ -781,6 +782,7 @@ create temporary table t1 (a int); execute stmt; table_name t1 +user call p_verify_reprepare_count(0); SUCCESS diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test index 90226d379bf..dafb5b5dea3 100644 --- a/mysql-test/main/ps_ddl.test +++ b/mysql-test/main/ps_ddl.test @@ -699,7 +699,7 @@ deallocate prepare stmt; --echo # --echo # Test 3: View referencing an Information schema table --echo # -create view t1 as select table_name from information_schema.views; +create view t1 as select table_name from information_schema.views order by table_name; prepare stmt from "select * from t1"; execute stmt; diff --git a/mysql-test/main/row.result b/mysql-test/main/row.result index 2d4ebc35b84..40d3e2640f0 100644 --- a/mysql-test/main/row.result +++ b/mysql-test/main/row.result @@ -483,7 +483,7 @@ select * from t1,t2 where (a,b) = (c,d); a b c d abc 1 abc 1 select host,user from mysql.user where (host,user) = ('localhost','test'); -host user +Host User drop table t1,t2; # # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings diff --git a/mysql-test/main/set_password.result b/mysql-test/main/set_password.result index 82154c6ae8c..bb1124e09d4 100644 --- a/mysql-test/main/set_password.result +++ b/mysql-test/main/set_password.result @@ -8,13 +8,13 @@ create user oldpass@localhost identified by password '378b243e220ca493'; create user oldpassold@localhost identified with 'mysql_old_password'; set password for oldpassold@localhost = '378b243e220ca493'; select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; -user host password plugin authentication_string -natauth localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -newpass localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -oldauth localhost mysql_old_password 378b243e220ca493 -oldpass localhost mysql_old_password 378b243e220ca493 -oldpassold localhost mysql_old_password 378b243e220ca493 +User Host Password plugin authentication_string +natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +oldauth localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 +oldpass localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 +oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 connect con,localhost,natauth,test,; select current_user(); current_user() @@ -85,13 +85,13 @@ set password for oldauth@localhost = PASSWORD('test2'); set password for oldpass@localhost = PASSWORD('test2'); set password for oldpassold@localhost = PASSWORD('test2'); select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; -user host password plugin authentication_string -natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +User Host Password plugin authentication_string +natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E connect con,localhost,natauth,test2,; select current_user(); current_user() diff --git a/mysql-test/main/set_password.test b/mysql-test/main/set_password.test index fc1ecb5ef5c..c67dc22dc81 100644 --- a/mysql-test/main/set_password.test +++ b/mysql-test/main/set_password.test @@ -132,6 +132,7 @@ set global secure_auth=default; # # MDEV-16238 root/localhost authn prioritizes authentication_string over Password # +--source include/switch_to_mysql_user.inc create user foo@localhost identified with mysql_native_password; update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost'; set password for 'foo'@'localhost' = password('bar'); @@ -145,3 +146,4 @@ select user,host,password,plugin,authentication_string from mysql.user where use set password for 'foo'@'localhost' = ''; select user,host,password,plugin,authentication_string from mysql.user where user='foo'; drop user foo@localhost; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/show_grants_with_plugin-7985.result b/mysql-test/main/show_grants_with_plugin-7985.result deleted file mode 100644 index 14d7b98bcf4..00000000000 --- a/mysql-test/main/show_grants_with_plugin-7985.result +++ /dev/null @@ -1,197 +0,0 @@ -call mtr.add_suppression("password and an authentication plugin"); -# -# Create a user with mysql_native_password plugin. -# The user has no password or auth_string set. -# -create user u1; -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password -# -# The user's grants should show no password at all. -# -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Test to see if connecting with no password is succesful. -# -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now add a mysql_native password string in authentication_string. -# -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626 -# -# Test to see if connecting with password is succesful. -# -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now we also set a password for the user. -# -set password for u1 = PASSWORD('SOMETHINGELSE'); -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -# -# Here we should use the password field, as that primes over -# the authentication_string field. -# -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Logging in with the user's password should work. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Reload privileges and test logging in again. -# -flush privileges; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Here we connect via the user's password again. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now we remove the authentication plugin password, flush privileges and -# try again. -# -update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -flush privileges; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Here we connect via the user's password. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -disconnect con1; -connection default; -# -# Try and set a wrong auth_string password, with mysql_native_password. -# Make sure it fails. -# -GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd'; -ERROR HY000: Password hash should be a 41-digit hexadecimal number -# -# Now set a correct password. -# -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Test if the user can now use that password instead. -# -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -# -# Test if the user can now use that password instead, after flushing privileges; -# -connection default; -flush privileges; -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Clear all passwords from the user. -# -set password for u1 = ''; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password -# -# Test no password connect. -# -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test no password connect, after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -drop user u1; diff --git a/mysql-test/main/show_grants_with_plugin-7985.test b/mysql-test/main/show_grants_with_plugin-7985.test deleted file mode 100644 index 85952870254..00000000000 --- a/mysql-test/main/show_grants_with_plugin-7985.test +++ /dev/null @@ -1,160 +0,0 @@ ---source include/not_embedded.inc -call mtr.add_suppression("password and an authentication plugin"); - ---echo # ---echo # Create a user with mysql_native_password plugin. ---echo # The user has no password or auth_string set. ---echo # - -create user u1; -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # The user's grants should show no password at all. ---echo # -show grants for u1; ---echo # ---echo # Test to see if connecting with no password is succesful. ---echo # ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Test after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Now add a mysql_native password string in authentication_string. ---echo # -# Password string is SOMETHING -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; ---echo # ---echo # Test to see if connecting with password is succesful. ---echo # ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Test after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Now we also set a password for the user. ---echo # -set password for u1 = PASSWORD('SOMETHINGELSE'); -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # Here we should use the password field, as that primes over ---echo # the authentication_string field. ---echo # -show grants for u1; - ---echo # ---echo # Logging in with the user's password should work. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -show grants; ---disconnect con1 ---connection default ---echo # ---echo # Reload privileges and test logging in again. ---echo # -flush privileges; -show grants for u1; ---echo # ---echo # Here we connect via the user's password again. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Now we remove the authentication plugin password, flush privileges and ---echo # try again. ---echo # -update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -flush privileges; -show grants for u1; ---echo # ---echo # Here we connect via the user's password. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; ---disconnect con1 ---connection default - ---echo # ---echo # Try and set a wrong auth_string password, with mysql_native_password. ---echo # Make sure it fails. ---echo # ---error ER_PASSWD_LENGTH -GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd'; ---echo # ---echo # Now set a correct password. ---echo # -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -show grants for u1; - ---echo # ---echo # Test if the user can now use that password instead. ---echo # ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 - ---echo # ---echo # Test if the user can now use that password instead, after flushing privileges; ---echo # ---connection default -flush privileges; - ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Clear all passwords from the user. ---echo # -set password for u1 = ''; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # Test no password connect. ---echo # ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Test no password connect, after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 ---connection default - -drop user u1; diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result index 051fbf3a7e8..662d52902d0 100644 --- a/mysql-test/main/sp-security.result +++ b/mysql-test/main/sp-security.result @@ -507,7 +507,7 @@ GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO user19857@localhost; SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; -Host User Plugin Authentication_string +Host User plugin authentication_string localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C connect mysqltest_2_con,localhost,user19857,meow,test; connection mysqltest_2_con; @@ -534,7 +534,7 @@ DROP PROCEDURE IF EXISTS test.sp19857; connection con1root; disconnect mysqltest_2_con; SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; -Host User Plugin Authentication_string +Host User plugin authentication_string localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C DROP USER user19857@localhost; disconnect con1root; @@ -765,21 +765,23 @@ connection default; disconnect conn1; drop user bug12602983_user@localhost; drop database mysqltest_db; +create user u1@localhost; +grant all privileges on *.* to u1@localhost with grant option; +connect u1, localhost, u1; set password=password('foobar'); create procedure sp1() select 1; show grants; -Grants for root@localhost -GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION -GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +Grants for u1@localhost +GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION grant execute on procedure sp1 to current_user() identified by 'barfoo'; show grants; -Grants for root@localhost -GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION -GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost' -GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +Grants for u1@localhost +GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION +GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'u1'@'localhost' drop procedure sp1; -set password=''; -update mysql.user set plugin=''; +disconnect u1; +connection default; +drop user u1@localhost; # # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE # diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test index dd917eed671..7a87fae4097 100644 --- a/mysql-test/main/sp-security.test +++ b/mysql-test/main/sp-security.test @@ -1035,15 +1035,18 @@ drop database mysqltest_db; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc +create user u1@localhost; +grant all privileges on *.* to u1@localhost with grant option; +connect u1, localhost, u1; set password=password('foobar'); create procedure sp1() select 1; show grants; grant execute on procedure sp1 to current_user() identified by 'barfoo'; show grants; drop procedure sp1; -set password=''; -#cleanup after MDEV-16238 -update mysql.user set plugin=''; +disconnect u1; +connection default; +drop user u1@localhost; --echo # --echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index 860f82ebd93..3883225e9bc 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -231,8 +231,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END; disconnect con1; connection default; DROP PROCEDURE p1; -DELETE FROM mysql.user WHERE User='mysqltest_1'; -FLUSH PRIVILEGES; # # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. # diff --git a/mysql-test/main/sp_notembedded.test b/mysql-test/main/sp_notembedded.test index 64f1daeaeb9..2f1c4cd92f5 100644 --- a/mysql-test/main/sp_notembedded.test +++ b/mysql-test/main/sp_notembedded.test @@ -305,6 +305,7 @@ set session low_priority_updates=default; # # Bug#44798 MySQL engine crashes when creating stored procedures with execute_priv=N # +--source include/switch_to_mysql_user.inc INSERT IGNORE INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, @@ -323,10 +324,7 @@ CREATE PROCEDURE p1(i INT) BEGIN END; disconnect con1; connection default; DROP PROCEDURE p1; - -DELETE FROM mysql.user WHERE User='mysqltest_1'; -FLUSH PRIVILEGES; - +--source include/switch_to_mysql_global_priv.inc --echo # --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. @@ -464,6 +462,7 @@ DROP EVENT teste_bug11763507; # A case of SHOW GRANTS # (creating a new procedure changes the password) # +--source include/switch_to_mysql_user.inc grant create routine on test.* to foo1@localhost identified by 'foo'; update mysql.user set authentication_string = replace(authentication_string, '*', '-') where user='foo1'; --connect (foo,localhost,foo1,foo) @@ -479,6 +478,7 @@ show grants; --disconnect foo drop procedure spfoo; drop user foo1@localhost; +--source include/switch_to_mysql_global_priv.inc # # Restore global concurrent_insert value. Keep in the end of the test file. diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index bcd9b4f062e..db550c1c80e 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -587,7 +587,7 @@ explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL -1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result index fc37ece99cb..c8b18f05876 100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@ -614,7 +614,7 @@ explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL -1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index bdc1df85131..e7cd9bc628b 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -60,57 +61,8 @@ db CREATE TABLE `db` ( KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' show create table user; -Table Create Table -user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', - `ssl_cipher` blob NOT NULL, - `x509_issuer` blob NOT NULL, - `x509_subject` blob NOT NULL, - `max_questions` int(11) unsigned NOT NULL DEFAULT 0, - `max_updates` int(11) unsigned NOT NULL DEFAULT 0, - `max_connections` int(11) unsigned NOT NULL DEFAULT 0, - `max_user_connections` int(11) NOT NULL DEFAULT 0, - `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', - `authentication_string` text COLLATE utf8_bin NOT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000, - PRIMARY KEY (`Host`,`User`) -) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' +View Create View character_set_client collation_connection +user CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci show create table func; Table Create Table func CREATE TABLE `func` ( @@ -120,6 +72,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( diff --git a/mysql-test/main/system_mysql_db_507.result b/mysql-test/main/system_mysql_db_507.result index 54e023d3d4d..1fa4af66719 100644 --- a/mysql-test/main/system_mysql_db_507.result +++ b/mysql-test/main/system_mysql_db_507.result @@ -3,8 +3,6 @@ # Fatal error: mysql.user table is damaged or in # unsupported 3.20 format # -create table backup_user like mysql.user; -insert into backup_user select * from mysql.user; # # Original mysql.user table # @@ -169,6 +167,3 @@ ioo % Y mysql_old_password 7a8f886d28473e85 # # Reset to final original state. # -drop table mysql.user; -rename table backup_user to mysql.user; -flush privileges; diff --git a/mysql-test/main/system_mysql_db_507.test b/mysql-test/main/system_mysql_db_507.test index d0ad685fbbc..b57a2a09c8e 100644 --- a/mysql-test/main/system_mysql_db_507.test +++ b/mysql-test/main/system_mysql_db_507.test @@ -5,9 +5,7 @@ --echo # unsupported 3.20 format --echo # - -create table backup_user like mysql.user; -insert into backup_user select * from mysql.user; +--source include/switch_to_mysql_user.inc --echo # --echo # Original mysql.user table @@ -90,11 +88,7 @@ select user, host, select_priv, plugin, authentication_string from mysql.user where user like "%oo" order by user; - --echo # --echo # Reset to final original state. --echo # -drop table mysql.user; -rename table backup_user to mysql.user; - -flush privileges; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index abb6fbb38e1..c4c4d3df706 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( diff --git a/mysql-test/main/system_mysql_db_fix40123.test b/mysql-test/main/system_mysql_db_fix40123.test index 2d17a0964e5..3f313c4ec1f 100644 --- a/mysql-test/main/system_mysql_db_fix40123.test +++ b/mysql-test/main/system_mysql_db_fix40123.test @@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index b3a0caa282f..3a79afb04f0 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( diff --git a/mysql-test/main/system_mysql_db_fix50030.test b/mysql-test/main/system_mysql_db_fix50030.test index 9506c3465e7..33dcc873615 100644 --- a/mysql-test/main/system_mysql_db_fix50030.test +++ b/mysql-test/main/system_mysql_db_fix50030.test @@ -79,7 +79,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index abb6fbb38e1..c4c4d3df706 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( diff --git a/mysql-test/main/system_mysql_db_fix50117.test b/mysql-test/main/system_mysql_db_fix50117.test index f8bef3da162..2fe6869d761 100644 --- a/mysql-test/main/system_mysql_db_fix50117.test +++ b/mysql-test/main/system_mysql_db_fix50117.test @@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index fcd3fc202e0..275acc97d8e 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -615,6 +615,7 @@ select is_updatable from information_schema.views; is_updatable YES YES +YES select * from t1; col1 col2 5 Hello, view world diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index eeb507ecad2..df1429eaa4d 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -562,11 +562,6 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; -drop view if exists v1; -drop table if exists t1; -create table t1 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; create user 'test14256'@'%'; grant all on test.* to 'test14256'@'%'; connect test14256,localhost,test14256,,test; @@ -592,9 +587,6 @@ test14256@% test14256@% 1 connection root; disconnect test14256; drop user test14256; -insert into mysql.user select * from t1; -flush privileges; -drop table t1; connection root; create database mysqltest; use mysqltest; diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index a70241138aa..65757e95fb3 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -669,16 +669,6 @@ drop database mysqltest; # # Bug#14256 definer in view definition is not fully qualified # ---disable_warnings -drop view if exists v1; -drop table if exists t1; ---enable_warnings - -# Backup anonymous users and remove them. (They get in the way of -# the one we test with here otherwise.) -create table t1 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; # Create the test user create user 'test14256'@'%'; @@ -708,12 +698,6 @@ connection root; disconnect test14256; drop user test14256; -# Restore the anonymous users. -insert into mysql.user select * from t1; -flush privileges; - -drop table t1; - # # Bug#14726 freeing stack variable in case of an error of opening a view when # we have locked tables with LOCK TABLES statement. |