/
ee_mod_install_mysql.sh
31 lines (23 loc) · 1.05 KB
/
ee_mod_install_mysql.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
26
27
28
29
30
31
# Install MySQL package
ee_mod_install_mysql()
{
# Random characters
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1)
# Check MySQL is installed or not
ee_lib_package_check mysql-server
# If MySQL is not installed
# Then set random MySQL password for root user
if [ -n "$EE_PACKAGE_NAME" ]; then
# Setting up MySQL password
debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password password $ee_random"
debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password_again password $ee_random"
# Generate ~/.my.cnf
echo -e "[client]\nuser=root\npassword=$ee_random" > ~/.my.cnf
fi
ee_lib_echo "Installing MySQL, please Wait..."
$EE_APT_GET install percona-server-server-5.6 mysqltuner percona-toolkit \
|| ee_lib_error "Unable to install MySQL, exit status = " $?
# Download tuning-primer.sh
wget --no-check-certificate -cqO /usr/local/bin/tuning-primer.sh https://launchpadlibrarian.net/78745738/tuning-primer.sh
chmod a+x /usr/local/bin/tuning-primer.sh
}