You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grant option is silently dropped when editing privileges on MySQL 8.0.11+ #20521
On MySQL (and Percona) 8.0.11 or newer, ticking Grant while editing a user's privileges has no effect. The grant option is never given. This happens at every level: global, database, table and routine. Nothing reports an error, and after saving, the checkbox is unticked again.
This is the root cause of #19605, which reports it for database-level privileges. It is not limited to that level, though.
To Reproduce
Use a MySQL 8.0.11+ server (reproduced on 8.4).
Server → User accounts → Edit privileges for any user → Database → pick a database.
Tick e.g. SELECT and GRANT, then press Go.
phpMyAdmin runs:
REVOKE ALL PRIVILEGES ON`db`.*FROM'u'@'h';
GRANTSELECTON`db`.* TO 'u'@'h';
ALTERUSER'u'@'h' ;
SHOW GRANTS FOR 'u'@'h' lists GRANT SELECT ON db.* TO u@h, without WITH GRANT OPTION.
The same happens on the Global tab (GRANT ... ON *.* TO 'u'@'h'; + ALTER USER 'u'@'h' REQUIRE NONE;).
Expected behavior
The GRANT statement ends with WITH GRANT OPTION, as it does on MySQL < 8.0.11 and on MariaDB:
GRANTSELECTON`db`.* TO 'u'@'h' WITH GRANT OPTION;
Cause
Since 8.0.11, Privileges::generateQueriesForUpdatePrivileges() moves the WITH clause from the GRANT to an ALTER USER statement. getWithClauseForAddUserAndUpdatePrivs() then correctly omits GRANT OPTION, because ALTER USER cannot set it. However, nothing appends WITH GRANT OPTION to the GRANT statement instead. The add-user path (getSqlQueriesForDisplayAndAddUser()) already handles this correctly.
The existing test testUpdatePrivilegesAfterMySql8Dot11 currently asserts the buggy output: it posts Grant_priv=Y but expects a GRANT without the grant option.
Server configuration
phpMyAdmin: QA_5_2 and master (a57149e); the code is the same in 5.2.x
Activity