This bug has been fixed in 10.4.6: https://jira.mariadb.org/browse/MDEV-14732
I have asked them if it can be backported to 10.1 but I have no hopes.

Cheers
Manuel.

El mar., 3 jul. 2018 7:52, Manuel Arostegui <marostegui@wikimedia.org> escribió:
Hello, 

Pretty much everyone who's dealt with creating views for new wikis on the labs hosts have experienced issues with "Access denied" sometimes.
This was usually due to the MariaDB grant role being missed. We tried to workaround this by including the grant addition on the maintain-views script.

Unfortunately, we ran into very weird problems when doing so and this is an example: https://phabricator.wikimedia.org/T193187#4273281

After lots of back and forth we decided to create a bug to MariaDB (https://jira.mariadb.org/browse/MDEV-16466) which was confirmed by MariaDB yesterday and pointed to a similar issue (https://jira.mariadb.org/browse/MDEV-14732).

The expected fix will come in 10.4 (we are in 10.1), so quite long ahead of us. 

So, for now, the workaround before adding new views is to manually add the GRANT on the DB and then run the script:

GRANT SELECT, SHOW VIEW ON `newiki\_p`.* to labsdbuser';

Hopefully with this email everyone is on the same page now.

Thanks everyone (specially Brooke for helping me out with the troubleshooting!)

Manuel.