mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16987 - ALTER DATABASE possible in read-only mode
Forbid ALTER DATABASE under read_only.
This commit is contained in:
@ -162,3 +162,14 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
|
|||||||
flush privileges;
|
flush privileges;
|
||||||
drop database mysqltest_db1;
|
drop database mysqltest_db1;
|
||||||
set global read_only= @start_read_only;
|
set global read_only= @start_read_only;
|
||||||
|
#
|
||||||
|
# MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||||
|
#
|
||||||
|
GRANT ALTER ON test1.* TO user1@localhost;
|
||||||
|
CREATE DATABASE test1;
|
||||||
|
SET GLOBAL read_only=1;
|
||||||
|
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||||
|
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||||
|
SET GLOBAL read_only=0;
|
||||||
|
DROP DATABASE test1;
|
||||||
|
DROP USER user1@localhost;
|
||||||
|
@ -310,3 +310,16 @@ set global read_only= @start_read_only;
|
|||||||
# Wait till all disconnects are completed
|
# Wait till all disconnects are completed
|
||||||
--source include/wait_until_count_sessions.inc
|
--source include/wait_until_count_sessions.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||||
|
--echo #
|
||||||
|
GRANT ALTER ON test1.* TO user1@localhost;
|
||||||
|
CREATE DATABASE test1;
|
||||||
|
SET GLOBAL read_only=1;
|
||||||
|
change_user user1;
|
||||||
|
--error ER_OPTION_PREVENTS_STATEMENT
|
||||||
|
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||||
|
change_user root;
|
||||||
|
SET GLOBAL read_only=0;
|
||||||
|
DROP DATABASE test1;
|
||||||
|
DROP USER user1@localhost;
|
||||||
|
@ -831,6 +831,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
|
|||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
|
|
||||||
if (lex->sql_command == SQLCOM_CREATE_DB ||
|
if (lex->sql_command == SQLCOM_CREATE_DB ||
|
||||||
|
lex->sql_command == SQLCOM_ALTER_DB ||
|
||||||
lex->sql_command == SQLCOM_DROP_DB)
|
lex->sql_command == SQLCOM_DROP_DB)
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user