Update MySQL privileges when starting phpBB3 import
authorGerhard Schlager <mail@gerhard-schlager.at>
Tue, 1 Oct 2019 14:59:22 +0000 (10:59 -0400)
committerGitHub <noreply@github.com>
Tue, 1 Oct 2019 14:59:22 +0000 (10:59 -0400)
MySQL isn't running in the init script yet, so updating the privileges doesn't work. Duh!

Follow-up to 3df237a6

templates/import/phpbb3.template.yml

index 19975879a3f241b3fda7e587006b17509be032c9..946aa883ad30b2df4b696da864f99c5d81f30a5f 100644 (file)
@@ -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..."