Comment 2 for bug 1936210

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

Grant statements are affected by the GTID mechanism:

https://docs.oracle.com/cd/E17952_01/mysql-8.0-en/replication-gtids-lifecycle.html
"Every database change (DDL or DML) that is written to the binary log is assigned a GTID. This includes changes that are autocommitted, and changes that are committed using BEGIN and COMMIT or START TRANSACTION statements. ***A GTID is also assigned to*** the creation, alteration, or deletion of a database, and of a ***non-table database object*** such as a procedure, function, trigger, event, view, user, role, or ***grant***."

The mysql.user table gets modified in the end by grant statements:
https://dev.mysql.com/doc/refman/8.0/en/grant-tables.html#grant-tables-user-db
"The user and db Grant Tables
The server uses the user and db tables in the mysql database at both the first and second stages of access control (see Section 6.2, “Access Control and Account Management”). The columns in the user and db tables are shown here."

As of MySQL 8.0 the grant tables (including the mysql.user) table are transactional:
https://dev.mysql.com/doc/refman/8.0/en/system-schema.html#system-schema-grant-tables - grant system tables.
"As of MySQL 8.0, the grant tables are InnoDB (transactional) tables. Previously, these were MyISAM (nontransactional) tables. The change of grant-table storage engine underlies an accompanying change in MySQL 8.0 to the behavior of account-management statements such as CREATE USER and GRANT. Previously, an account-management statement that named multiple users could succeed for some users and fail for others. The statements are now transactional and either succeed for all named users or roll back and have no effect if any error occurs."