# # Testing FILE privilege # set sql_mode=""; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; set sql_mode=default; connect user,localhost,user,,; connection user; SELECT user(); user() user@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT'; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() root@localhost CREATE TABLE t1remote (a INT NOT NULL); INSERT INTO t1remote VALUES (10),(20),(30); CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL TABNAME=t1remote OPTION_LIST='host=localhost,user=root,port=PORT'; SELECT * FROM t1; a 10 20 30 connection user; SELECT user(); user() user@localhost SELECT * FROM t1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO t1 VALUES ('xxx'); ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1 WHERE a='xxx'; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a='yyy' WHERE a='xxx'; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; connection user; SELECT user(); user() user@localhost SELECT * FROM v1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation disconnect user; connection default; SELECT user(); user() root@localhost DROP VIEW v1; DROP TABLE t1, t1remote; DROP USER user@localhost; # # Testing FILE privileges done #