Server IP : 104.21.38.3 / Your IP : 162.158.163.233 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/perfschema/r/ |
Upload File : |
use performance_schema; set @start_read_only= @@global.read_only; set @start_super_read_only= @@global.super_read_only; set @orig_sql_mode= @@sql_mode; set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER','')); Warnings: Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; Warnings: Warning 1287 Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement. set sql_mode= @orig_sql_mode; Warnings: Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. flush privileges; connect con1, localhost, pfsuser, , test; connection default; set global read_only=0; connection con1; select @@global.read_only; @@global.read_only 0 show grants; Grants for pfsuser@localhost GRANT USAGE ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' select * from performance_schema.setup_instruments; update performance_schema.setup_instruments set enabled='NO'; update performance_schema.setup_instruments set enabled='YES'; connection default; set global read_only=1; connection con1; select @@global.read_only; @@global.read_only 1 show grants; Grants for pfsuser@localhost GRANT USAGE ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' # Update on perf_schema is allowed in read_only mode. select * from performance_schema.setup_instruments; update performance_schema.setup_instruments set enabled='NO'; update performance_schema.setup_instruments set enabled='YES'; connection default; grant super on *.* to pfsuser@localhost; flush privileges; disconnect con1; connect con1, localhost, pfsuser, , test; select @@global.read_only; @@global.read_only 1 show grants; Grants for pfsuser@localhost GRANT SUPER ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' select * from performance_schema.setup_instruments; update performance_schema.setup_instruments set enabled='NO'; update performance_schema.setup_instruments set enabled='YES'; connection default; set global super_read_only=1; connection con1; select @@global.super_read_only; @@global.super_read_only 1 show grants; Grants for pfsuser@localhost GRANT SUPER ON *.* TO 'pfsuser'@'localhost' GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' select * from performance_schema.setup_instruments; # Update is allowed in super_read_only on perf schema for # super user. update performance_schema.setup_instruments set enabled='NO'; update performance_schema.setup_instruments set enabled='YES'; # # Bug#31080309 - REGRESSION FOR BUG 81009 FIXED IN 5.7.17 # Bug23103937(BUG81009) - PS_TRUNCATE_ALL_TABLES() DOES NOT WORK IN # SUPER_READ_ONLY MODE. # connection default; # Reset read_only and super_read_only mode. set global read_only=0; set global super_read_only=0; # Grant truncate table and execute stored procedure privileges to pfsuser. grant DROP on performance_schema.* to pfsuser@localhost; grant EXECUTE on procedure sys.ps_truncate_all_tables to pfsuser@localhost; #----------------------------------------------------------------------- # Test case to verify truncate operation on performance schema table by # super user with super_read_only=ON. #----------------------------------------------------------------------- # Set super_read_only mode. set global super_read_only=1; connection con1; # truncate operation is allowed in super_read_only mode on performance schema # tables for super user. # Without fix following statements fail because of super read only mode. truncate table performance_schema.events_statements_summary_by_digest; call sys.ps_truncate_all_tables(0); #----------------------------------------------------------------------- # Test case to verify truncate operation on performance schema table by # super user with read_only=ON. #----------------------------------------------------------------------- connection default; # Reset super_read_only mode. set global super_read_only=0; # Set read_only mode. set global read_only=1; connection con1; # truncate operation is allowed in read_only mode on performance schema # tables for super user. # Without fix following statements fail because of super read only mode. truncate table performance_schema.events_statements_summary_by_digest; call sys.ps_truncate_all_tables(0); #----------------------------------------------------------------------- # Test case to verify truncate operation on performance schema table by # non-super user with super_read_only=ON. #----------------------------------------------------------------------- connection default; set global super_read_only=0; # Revoke SUPER privilege from pfsuser. revoke SUPER on *.* from pfsuser@localhost; # Reset super_read_only mode. set global super_read_only=1; connection con1; # truncate operation is allowed in super_read_only mode on performance schema # tables for non-super user. truncate table performance_schema.events_statements_summary_by_digest; call sys.ps_truncate_all_tables(0); #----------------------------------------------------------------------- # Test case to verify truncate operation on performance schema table by # non-super user with read_only=ON. #----------------------------------------------------------------------- connection default; # Reset super_read_only mode. set global super_read_only=0; # Set read_only mode. set global read_only=1; connection con1; # truncate operation is allowed in read_only mode on performance schema # tables for non-super user. truncate table performance_schema.events_statements_summary_by_digest; call sys.ps_truncate_all_tables(0); ######################################################################## disconnect con1; connection default; set global read_only= @start_read_only; set global super_read_only= @start_super_read_only; drop user pfsuser@localhost; flush privileges;