-- source include/not_embedded.inc CREATE USER mysqluser1@localhost; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW ON mysqltest2.* TO mysqluser1@localhost; USE mysqltest1; CREATE TABLE t1( a INT ); CREATE TABLE t2( a INT, b INT ); CREATE VIEW v1 AS SELECT 1 AS a; CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b; GRANT SELECT ON t1 TO mysqluser1@localhost; GRANT SELECT (b) ON t2 TO mysqluser1@localhost; GRANT SELECT ON v1 TO mysqluser1@localhost; GRANT SELECT (b) ON v2 TO mysqluser1@localhost; --connect (connection1, localhost, mysqluser1,, mysqltest2) CREATE VIEW v_t1 AS SELECT * FROM mysqltest1.t1; CREATE VIEW v_t2 AS SELECT * FROM mysqltest1.t1; CREATE VIEW v_v1 AS SELECT * FROM mysqltest1.v1; CREATE VIEW v_v2 AS SELECT * FROM mysqltest1.v1; --connection default DROP TABLE t1; ALTER TABLE t2 DROP COLUMN b; DROP VIEW v1; DROP VIEW v2; CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b; --connection connection1 --error ER_VIEW_NO_EXPLAIN SHOW CREATE VIEW v_t1; --error ER_VIEW_NO_EXPLAIN SHOW CREATE VIEW v_t2; --error ER_VIEW_NO_EXPLAIN SHOW CREATE VIEW v_v1; --error ER_VIEW_NO_EXPLAIN SHOW CREATE VIEW v_v2; --disconnect connection1 --connection default DROP USER mysqluser1@localhost; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; USE test;