From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Tue, 1 Oct 2019 14:59:22 +0000 (-0400)
Subject: Update MySQL privileges when starting phpBB3 import
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ac6930c9790f3277906c47e7e70c65837b60358b;p=discourse_docker.git

Update MySQL privileges when starting phpBB3 import

MySQL isn't running in the init script yet, so updating the privileges doesn't work. Duh!

Follow-up to 3df237a6
---

diff --git a/templates/import/phpbb3.template.yml b/templates/import/phpbb3.template.yml
index 1997587..946aa88 100644
--- a/templates/import/phpbb3.template.yml
+++ b/templates/import/phpbb3.template.yml
@@ -52,10 +52,6 @@ hooks:
           chown mysql -R /shared/import/mysql/data
           /usr/bin/mysql_install_db --user=mysql
 
-          # Allow connection as root user without password
-          mysql -uroot -e "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket'"
-          mysql -uroot -e "FLUSH PRIVILEGES"
-
           # Shamelessly copied from http://smarden.org/runit1/runscripts.html#mysql
           MYSQLADMIN='/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf'
           trap "$MYSQLADMIN shutdown" 0
@@ -79,6 +75,10 @@ hooks:
           chown discourse /shared/import/settings.yml
           chown discourse -R /shared/import/data
 
+          # Allow connection as root user without password
+          mysql -uroot -e "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket'"
+          mysql -uroot -e "FLUSH PRIVILEGES"
+
           if [ -f "/shared/import/data/phpbb_mysql.sql" ]; then
             if [ -f "/shared/import/mysql/imported" ] && ! sha256sum --check /shared/import/mysql/imported &>/dev/null ; then
               echo "Checksum of database dump changed..."