Clear plugin on mariadb users

This commit is contained in:
Bob Mottram 2017-06-05 21:48:27 +01:00
parent 6daa9664f1
commit 542515be7d
1 changed files with 3 additions and 0 deletions

View File

@ -178,6 +178,7 @@ function install_mariadb {
systemctl restart mariadb
run_query mysql "CREATE USER 'root@localhost' IDENTIFIED BY '${MARIADB_PASSWORD}'; flush privileges;"
run_query mysql "update mysql.user set plugin = '' where User='root@localhost'; flush privileges;"
run_query mysql "GRANT ALL PRIVILEGES ON * TO 'root@localhost'; flush privileges;"
mysqladmin -u root password "$MARIADB_PASSWORD"
@ -270,7 +271,9 @@ function create_database {
fi
echo "create database ${app_name};
CREATE USER '$app_admin_username@localhost' IDENTIFIED BY '${app_admin_password}';
update mysql.user set plugin = '' where User='$app_admin_username@localhost';
GRANT ALL PRIVILEGES ON ${app_name}.* TO '$app_admin_username@localhost';
flush privileges;
quit" > $INSTALL_DIR/batch.sql
chmod 600 $INSTALL_DIR/batch.sql
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql