From 2147263bbf3ef1a3e4cbde1712555e50230be243 Mon Sep 17 00:00:00 2001 From: zeus Date: Sun, 2 Jan 2022 02:04:22 +0200 Subject: [PATCH] add --- .../usr/share/swarmlab.io/sec/sec_bootstrapmysql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql b/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql index 8432c5c..652534f 100755 --- a/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql +++ b/install/usr/share/swarmlab.io/sec/sec_bootstrapmysql @@ -83,13 +83,17 @@ case $ROLE in # ${USER}@${MPI_MASTER_SERVICE_NAME} \ ttyd -p 3787 bash & chmod 644 /etc/mysql/mysql.conf.d/mysqld.cnf - mysqld --user=root + mysqld --user=root & sleep 2 - mysql -e "create database $MYSQL_DATABASE ; GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO $MYSQL_USER@localhost IDENTIFIED BY '$MYSQL_PASSWORD'" + if ! mysql -e "use $MYSQL_DATABASE "; then + mysql -e "create database $MYSQL_DATABASE ; " + mysql -e "GRANT ALL PRIVILEGES ON $MYSQL_DATABASE.* TO $MYSQL_USER@localhost IDENTIFIED BY '$MYSQL_PASSWORD'" + mysql -e "flush PRIVILEGES " sleep 1 - mysql exampledb -e "UPDATE wp_options SET option_name = 'siteurl', option_value = 'http://localhost:$SERVICEPORT', autoload = 'yes' WHERE option_name = 'siteurl' " - - mysql exampledb -e "UPDATE wp_options SET option_name = 'home', option_value = 'http://localhost:$SERVICEPORT', autoload = 'yes' WHERE option_name = 'home' " + else + mysql -e "use $MYSQL_DATABASE; UPDATE wp_options SET option_name = 'siteurl', option_value = 'http://localhost:$SERVICEPORT', autoload = 'yes' WHERE option_name = 'siteurl' " + mysql -e "use $MYSQL_DATABASE; UPDATE wp_options SET option_name = 'home', option_value = 'http://localhost:$SERVICEPORT', autoload = 'yes' WHERE option_name = 'home' " + fi tail -f /dev/null #done ;;