Set mariadb password

This commit is contained in:
Bob Mottram 2017-06-05 21:14:17 +01:00
parent 346e85f4b9
commit 45df6aad24
1 changed files with 8 additions and 4 deletions

View File

@ -162,16 +162,20 @@ function install_mariadb {
exit 34672
fi
#if [ ! -f /etc/mysql/conf.d/my.cnf ]; then
# echo $'/etc/mysql/conf.d/my.cnf not found'
# exit 6376245
#fi
sed -i 's|ExecStart=/usr/sbin/mysqld|ExecStart=/usr/sbin/mysqld --skip-grant-tables|g' /lib/systemd/system/mariadb.service
systemctl daemon-reload
systemctl restart mariadb
# See http://www.pontikis.net/blog/debian-9-stretch-rc3-web-server-setup-php7-mariadb
# https://mariadb.com/kb/en/mariadb/unix_socket-authentication-plugin
function_check run_query
run_query_root mysql "update mysql.user set plugin = '' where User='root'; flush privileges;"
run_query_root mysql "UPDATE user SET Password=PASSWORD('$MARIADB_PASSWORD') where USER='root'; flush privileges;"
sed -i 's| --skip-grant-tables||g' /lib/systemd/system/mariadb.service
systemctl daemon-reload
systemctl restart mariadb
mysqladmin -u root password "$MARIADB_PASSWORD"
mark_completed $FUNCNAME