-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall-mysql.sh
More file actions
executable file
·47 lines (35 loc) · 843 Bytes
/
install-mysql.sh
File metadata and controls
executable file
·47 lines (35 loc) · 843 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
###
if ! which expect &> /dev/null;
then
echo "Unable to find command 'expect', run ./install-essentials.sh first"
exit
fi;
###
echo -n "MySQL \"root\" user password (leave blank for none): "
read -s MYSQLPASSWORD
echo ""
if [ ! -z "$MYSQLPASSWORD" ]
then
echo -n "Retype MySQL \"root\" user password: "
read -s MYSQLPASSWORD2
echo ""
if [ "$MYSQLPASSWORD" != "$MYSQLPASSWORD2" ]
then
echo "MySQL \"root\" user passwords do not match"
exit
fi
fi
###
expect << EOF
spawn apt-get -yq install mysql-server
expect "New password for the MySQL \"root\" user:"
send "${MYSQLPASSWORD}\r"
expect "Repeat password for the MySQL \"root\" user:"
send "${MYSQLPASSWORD}\r"
expect eof;
EOF
apt-get -yq install mysql-client
sed -e "s/^bind-address/#bind-address/g" -i /etc/mysql/my.cnf
sleep 2
service mysql restart