Set mariadb password
This commit is contained in:
parent
346e85f4b9
commit
45df6aad24
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue