forked from StackStorm/showcase-ansible-chatops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sh
executable file
·25 lines (20 loc) · 827 Bytes
/
db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
set -e
echo "#############################################################################################"
echo "##################################### Prepare db VM #########################################"
apt-get -qq update
# Install MySQL, set root password to 'PASS'
export DEBIAN_FRONTEND=noninteractive
debconf-set-selections <<< 'mysql-server mysql-server/root_password password PASS'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password PASS'
apt-get install -y mysql-server
# Enable `mysql` autologin for `root` linux user
touch ~/.my.cnf
chmod 0640 ~/.my.cnf
echo -e '[client]
user=root
password=PASS' > ~/.my.cnf
# Verify mysql installation
mysql --execute='SHOW PROCESSLIST;' > /dev/null || (echo 'Error! MySQL command failed' && exit 1)
echo "Done!"
exit 0