gau1991
11 years ago
3 changed files with 50 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||
# Install mysql package |
|||
|
|||
ee_lib_install_mysql() |
|||
{ |
|||
# Mysql password only set if mysql is not installed |
|||
# if mysql is installed don't set wrong password in ~/.my.cnf |
|||
ee_lib_package_check mysql-server |
|||
if [ -n $PACKAGE_NAME ]; then |
|||
|
|||
# setting up mysql password |
|||
local ee_mysql_auto_pass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) |
|||
debconf-set-selections <<< "mysql-server mysql-server/root_password password $ee_mysql_auto_pass" |
|||
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $ee_mysql_auto_pass" |
|||
|
|||
# Generate ~/.my.cnf |
|||
echo -e "[client]\nuser=root\npassword=$ee_mysql_auto_pass" > ~/.my.cnf |
|||
fi |
|||
|
|||
ee_lib_echo "Installing MySQL, Please Wait..." |
|||
$EE_APT_GET install mysql-server mysqltuner percona-toolkit \ |
|||
|| ee_lib_error "Unable To Install MySQL" |
|||
} |
@ -0,0 +1,10 @@ |
|||
# Setup mysql |
|||
|
|||
ee_lib_setup_mysql() |
|||
{ |
|||
# personal settings for mysql |
|||
ee_lib_echo "Updating MySQL Configuration Files, Please Wait..." |
|||
|
|||
# Decrease mysql wait timeout |
|||
sed -i "/#max_connections/a wait_timeout = 30 \ninteractive_timeout = 60" /etc/mysql/my.cnf |
|||
} |
Loading…
Reference in new issue