Make mariadb chart compatible with mariadb 10.4.13

since mariadb 10.4.13 definer of view mysql.user is not root
but mariadb.sys user. So when we remove it we break mysql_upgrade,
it fails to fix views. It is safe not to remove it because
the account by default is locked and cannot login.

Change-Id: I5183d7cbb09e18d0e87e0aef8c59bb71ec2f1cb5
Related-Bug: https://jira.mariadb.org/browse/MDEV-22542
This commit is contained in:
Mykyta Karpin 2020-05-15 17:25:27 +03:00 committed by Chris Wedgwood
parent 5e316a9ba0
commit 1482193fd4
1 changed files with 6 additions and 2 deletions

View File

@ -264,7 +264,11 @@ def mysqld_bootstrap():
], logger)
if not mysql_dbaudit_username:
template = (
"DELETE FROM mysql.user ;\n" # nosec
# NOTE: since mariadb 10.4.13 definer of view
# mysql.user is not root but mariadb.sys user
# it is safe not to remove it because the account by default
# is locked and cannot login
"DELETE FROM mysql.user WHERE user != 'mariadb.sys' ;\n" # nosec
"CREATE OR REPLACE USER '{0}'@'%' IDENTIFIED BY \'{1}\' ;\n"
"GRANT ALL ON *.* TO '{0}'@'%' WITH GRANT OPTION ;\n"
"DROP DATABASE IF EXISTS test ;\n"
@ -275,7 +279,7 @@ def mysqld_bootstrap():
mysql_dbsst_username, mysql_dbsst_password))
else:
template = (
"DELETE FROM mysql.user ;\n" # nosec
"DELETE FROM mysql.user WHERE user != 'mariadb.sys' ;\n" # nosec
"CREATE OR REPLACE USER '{0}'@'%' IDENTIFIED BY \'{1}\' ;\n"
"GRANT ALL ON *.* TO '{0}'@'%' WITH GRANT OPTION ;\n"
"DROP DATABASE IF EXISTS test ;\n"