From 1482193fd4a0f43d7adc9a5a92d271e6e8a3ea5d Mon Sep 17 00:00:00 2001 From: Mykyta Karpin Date: Fri, 15 May 2020 17:25:27 +0300 Subject: [PATCH] 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 --- mariadb/templates/bin/_start.py.tpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mariadb/templates/bin/_start.py.tpl b/mariadb/templates/bin/_start.py.tpl index 890b8698f..1275fb5f5 100644 --- a/mariadb/templates/bin/_start.py.tpl +++ b/mariadb/templates/bin/_start.py.tpl @@ -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"