mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
4abb8216a0
Implement User_table_json. Fix scripts to use mysql.global_priv. Fix tests.
160 lines
5.3 KiB
Text
160 lines
5.3 KiB
Text
set GLOBAL sql_mode="";
|
|
set LOCAL sql_mode="";
|
|
connect master,localhost,root,,;
|
|
connection master;
|
|
create database d1;
|
|
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
|
flush privileges;
|
|
connect sample,localhost,sample,password,d1;
|
|
connection sample;
|
|
select database();
|
|
database()
|
|
d1
|
|
create database d2;
|
|
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
|
|
create database D1;
|
|
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
|
|
disconnect sample;
|
|
connection master;
|
|
drop user 'sample'@'localhost';
|
|
drop database if exists d1;
|
|
disconnect master;
|
|
connection default;
|
|
CREATE DATABASE d1;
|
|
USE d1;
|
|
CREATE TABLE T1(f1 INT);
|
|
CREATE TABLE t1(f1 INT);
|
|
GRANT SELECT ON T1 to user_1@localhost;
|
|
connect con1,localhost,user_1,,d1;
|
|
select * from t1;
|
|
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
|
|
select * from T1;
|
|
f1
|
|
connection default;
|
|
GRANT SELECT ON t1 to user_1@localhost;
|
|
connection con1;
|
|
select * from information_schema.table_privileges;
|
|
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
|
'user_1'@'localhost' def d1 T1 SELECT NO
|
|
'user_1'@'localhost' def d1 t1 SELECT NO
|
|
connection default;
|
|
disconnect con1;
|
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
|
DROP USER user_1@localhost;
|
|
DROP DATABASE d1;
|
|
USE test;
|
|
CREATE DATABASE db1;
|
|
USE db1;
|
|
CREATE PROCEDURE p1() BEGIN END;
|
|
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
|
|
GRANT USAGE ON db1.* to user_1@localhost;
|
|
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
|
|
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
|
|
GRANT UPDATE ON db1.* to USER_1@localhost;
|
|
connect con1,localhost,user_1,,db1;
|
|
call p1();
|
|
call P1();
|
|
select f1(1);
|
|
f1(1)
|
|
2
|
|
connect con2,localhost,USER_1,,db1;
|
|
call p1();
|
|
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
|
|
call P1();
|
|
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
|
|
select f1(1);
|
|
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
|
|
connection default;
|
|
disconnect con1;
|
|
disconnect con2;
|
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
|
DROP FUNCTION f1;
|
|
DROP PROCEDURE p1;
|
|
DROP USER user_1@localhost;
|
|
DROP USER USER_1@localhost;
|
|
DROP DATABASE db1;
|
|
use test;
|
|
#
|
|
# Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
|
|
#
|
|
CREATE TABLE t1(a INT);
|
|
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
|
|
RENAME TABLE t1 TO T1;
|
|
ALTER TABLE T1 RENAME t1;
|
|
DROP TABLE t1;
|
|
create database TEST;
|
|
create procedure TEST.pr() begin end;
|
|
create procedure test.pr() begin end;
|
|
Phase 1/7: Checking and upgrading mysql database
|
|
Processing databases
|
|
mysql
|
|
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
|
|
mysql.help_relation OK
|
|
mysql.help_topic OK
|
|
mysql.index_stats OK
|
|
mysql.innodb_index_stats
|
|
Error : Unknown storage engine 'InnoDB'
|
|
error : Corrupt
|
|
mysql.innodb_table_stats
|
|
Error : Unknown storage engine 'InnoDB'
|
|
error : Corrupt
|
|
mysql.plugin OK
|
|
mysql.proc OK
|
|
mysql.procs_priv OK
|
|
mysql.proxies_priv OK
|
|
mysql.roles_mapping OK
|
|
mysql.servers OK
|
|
mysql.table_stats OK
|
|
mysql.tables_priv OK
|
|
mysql.time_zone OK
|
|
mysql.time_zone_leap_second OK
|
|
mysql.time_zone_name OK
|
|
mysql.time_zone_transition OK
|
|
mysql.time_zone_transition_type OK
|
|
mysql.transaction_registry
|
|
Error : Unknown storage engine 'InnoDB'
|
|
error : Corrupt
|
|
|
|
Repairing tables
|
|
mysql.innodb_index_stats
|
|
Error : Unknown storage engine 'InnoDB'
|
|
error : Corrupt
|
|
mysql.innodb_table_stats
|
|
Error : Unknown storage engine 'InnoDB'
|
|
error : Corrupt
|
|
mysql.transaction_registry
|
|
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
|
|
Processing databases
|
|
TEST
|
|
information_schema
|
|
mtr
|
|
mtr.global_suppressions OK
|
|
mtr.test_suppressions OK
|
|
performance_schema
|
|
test
|
|
Phase 7/7: Running 'FLUSH PRIVILEGES'
|
|
OK
|
|
drop procedure test.pr;
|
|
drop database TEST;
|
|
create table t1 (a int);
|
|
create trigger t1_bi before insert on t1 for each row set new.a= 1;
|
|
show triggers like '%T1%';
|
|
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
|
drop table t1;
|
|
set GLOBAL sql_mode=default;
|