diskimage-builder/elements/mysql/first-boot.d/50-mysql
Monty Taylor 1eff4a436e Rename flavour to element.
Flavour is overloaded in openstack due to it being used by nova. Element
seems to have the same feeling of combinability without using a term already
in active use in the openstack community.

Change-Id: Ia4c028d4062a8f69c66665821c94dd4bcdf06031
2012-12-05 14:04:58 -08:00

25 lines
503 B
Bash
Executable File

#!/bin/bash
set -e
set -o xtrace
# get MYSQL_PASS and HOST_IP
source $(dirname $0)/defaults
service mysql stop || true
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables"
sqltfile=`mktemp`
cat <<EOF > $sqltfile
USE mysql;
UPDATE user SET password=PASSWORD("$MYSQL_PASS") WHERE user='root';
EOF
$MYSQL_BOOTSTRAP < $sqltfile
rm -f $sqltfile
CNF=/etc/mysql/my.cnf
cp -f $(dirname $0)/my.cnf $CNF
sed -i "s/^bind-address=.*/bind-address=$HOST_IP/" $CNF
service mysql start