MariaDB instances in clouddb* hosts have a maintainviews user that is used by the maintain-views script to create and update the database views.
The grants for this user are defined in wiki-replicas.sql but are applied manually.
Some grants are redundant, and some contain a wrong double escape \\_ instead of \_. Some grants are also different in different hosts, for example:
root@clouddb1017:s3[(none)]> SHOW GRANTS FOR 'maintainviews'@localhost; [...] | GRANT ALL PRIVILEGES ON `meta\\_p`.* TO `maintainviews`@`localhost` |
root@clouddb1014:s7[(none)]> SHOW GRANTS FOR 'maintainviews'@localhost; [...] | GRANT ALL PRIVILEGES ON `meta\_p`.* TO `maintainviews`@`localhost` |
We should remove the redundant grants, fix the wrong escapes and make sure that the same grants are applied consistently to all clouddb* hosts and to an-redacteddb1001.
We should also add a new grant for the maintainviews user so that it has full privileges on %\_maintain databases, which will be required by the new version of the maintain-views script: T351637: [wikireplicas] add proper dry-run/diff mode to maintain-views.