ERROR 1226 (42000): User 'root' has exceeded the 'max_user_connections' resource (current value: -1) I'm using mariadb and have error

ERROR 1226 (42000): User 'root' has exceeded the 'max_user_connections' resource (current value: -1)

I'm set max_connection to 1000 and not set max_user_connections in Global and user table. 

How can I fix that.
The quick and dirty fix is FLUSH USER_RESOURCES


  USER_RESOURCES
  
  Resets all per-hour user resources to zero. This enables clients that have reached their hourly connection, query, or update limits to resume activity immediately. FLUSH USER_RESOURCES does not apply to the limit on maximum simultaneous connections. See Section 6.3.4, “Setting Account Resource Limits”.


Since you did not set any user recsource limits, I would suspect a misalignment of columns in the mysql.user table, especially if you performed mysql_upgrade with fixing the grant tables. 

To check this run this query

select ordinal_position from information_schema.columns
where table_schema='mysql' and table_name='user' and column_name='max_user_connections';


I get 40 in MySQL 5.6.

If I upgraded MySQL 5.6 and I don't get 40 from this query, I would just run 

mysql_upgrade --upgrade-system-tables


There is a 6-month-old bug on a similar issue : MySQL Forums :: Newbie :: ERROR 1226 (42000) at line 1129: User 'root' has exceeded the 'max_updates' resource (current value: 100)