Bug #87674 Table 'user' was not locked with LOCK TABLES on FLUSH PRIVILEGES
Submitted: 6 Sep 2017 4:39 Modified: 6 Sep 2017 5:47
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S1 (Critical)
Version:5.7.17, 5.6.37, 5.7.19 OS:Any
Assigned to: CPU Architecture:Any

[6 Sep 2017 4:39] Roel Van de Paar
Description:
Using the testcase in  'How to repeat', we get;
...
5.7.17>CREATE TABLE t1(c1 CHAR (1));
Query OK, 0 rows affected (0.09 sec)

5.7.17>FLUSH TABLES t1 FOR EXPORT;
Query OK, 0 rows affected (0.05 sec)

5.7.17>FLUSH PRIVILEGES;
ERROR 1100 (HY000): Table 'user' was not locked with LOCK TABLES

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(c1 CHAR (1));
FLUSH TABLES t1 FOR EXPORT;
FLUSH PRIVILEGES;

Suggested fix:
Related: https://dev.mysql.com/doc/refman/5.7/en/flush.html#flush-tables-for-export-with-list
[6 Sep 2017 5:47] Umesh Shastry
Hi Roel,

Thank you for the report.

Thanks,
Umesh