34 lines
1.3 KiB
Diff
34 lines
1.3 KiB
Diff
|
|
From: Egbert Eich <eich@suse.com>
|
||
|
|
Date: Mon Oct 4 19:49:16 2021 +0200
|
||
|
|
Subject: common: Create database user separately to allow empty password
|
||
|
|
Patch-mainline: Not yet
|
||
|
|
Git-commit: 3e87929be4b49584a9a3d5c51ef5eb2dc2d1792a
|
||
|
|
References:
|
||
|
|
|
||
|
|
Signed-off-by: Egbert Eich <eich@suse.com>
|
||
|
|
---
|
||
|
|
common/libexec/wwinit/10-database.init | 10 +++++++---
|
||
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||
|
|
diff --git a/common/libexec/wwinit/10-database.init b/common/libexec/wwinit/10-database.init
|
||
|
|
index 5d0626b..c58c5c0 100644
|
||
|
|
--- a/common/libexec/wwinit/10-database.init
|
||
|
|
+++ b/common/libexec/wwinit/10-database.init
|
||
|
|
@@ -183,10 +183,14 @@ if [ "$DATASTORE" = "mysql" ]; then
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ -n "$DBUSER" ] && [ "$DBUSER" != "root" ]; then
|
||
|
|
- wwprint "Updating database permissions for base user"
|
||
|
|
+ wwprint "Creating base user if it doesn't exist"
|
||
|
|
wwrun mysql $CLI_ARGS $DBNAME <<- END_OF_SQL
|
||
|
|
- GRANT SELECT on $DBNAME.*
|
||
|
|
- TO '$DBUSER'@'$DBCLIENT' IDENTIFIED BY '$DBPASS'
|
||
|
|
+ CREATE USER if not exists '$DBUSER'@'$DBCLIENT';
|
||
|
|
+ END_OF_SQL
|
||
|
|
+ wwprint "Updating database permissions for base user"
|
||
|
|
+ wwrun mysql $CLI_ARGS $DBNAME <<- END_OF_SQL
|
||
|
|
+ GRANT SELECT on $DBNAME.*
|
||
|
|
+ TO '$DBUSER'@'$DBCLIENT' IDENTIFIED BY '$DBPASS'
|
||
|
|
END_OF_SQL
|
||
|
|
fi
|
||
|
|
|