summaryrefslogtreecommitdiff
path: root/templates/setmysqlpass.sh.erb
blob: fbca07e28121e47a1eed317a1436410b99c371d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
#
# Change MySQL root password.
#

# Config
PASSWORD="<%= mysql_rootpw %>"
DEFAULTS="/etc/mysql/debian.cnf"

# Run
echo "USE mysql; UPDATE user SET Password=PASSWORD('$PASSWORD') WHERE User='root' AND Host='localhost'; flush privileges;" | \
  /usr/bin/mysql --defaults-file=$DEFAULTS