Commit 02c711bd authored by Andrew Ladlow's avatar Andrew Ladlow
Browse files

mysql: Add guard to check for existance of .mysql.hash file

parent a1628f32
......@@ -45,7 +45,10 @@ fi
# Add an admin user with user/password authentication for phpmyadmin if one doesn't already exist
#
if [ "$(mysql -u root -se "select exists(select user from mysql.user where user = 'admin');")" = "0" ] && grep -qx 'password = ' /etc/mysql/debian.cnf; then
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by password '*$(cat /etc/first-boot.d/.mysql.hash)' with grant option;"
if [ -e /etc/first-boot.d/.mysql.hash ]; then
echo "I: Adding 'admin'@'localhost' MySQL user"
mysql -u root -e "grant all privileges on *.* to 'admin'@'localhost' identified by password '*$(cat /etc/first-boot.d/.mysql.hash)' with grant option;"
fi
fi
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment