Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wojtek
committed
Mar 9, 2018
1 parent
512cad3
commit 175c0a5
Showing
5 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,6 @@ base_setup | |
|
||
install_apache | ||
install_composer | ||
install_mysql | ||
mysql_add_user user pass | ||
install_tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[client] | ||
default-character-set=utf8 | ||
|
||
[mysql] | ||
default-character-set=utf8 | ||
|
||
|
||
[mysqld] | ||
collation-server = utf8_unicode_ci | ||
init-connect='SET NAMES utf8' | ||
character-set-server = utf8 | ||
default-storage-engine=InnoDB | ||
innodb_file_per_table=ON | ||
innodb_file_format=barracuda | ||
innodb_strict_mode=ON | ||
innodb_buffer_pool_size = 256M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
|
||
function install_mysql() | ||
{ | ||
header 'Installing MySQL' | ||
|
||
if [ "$1" != "" ] | ||
then | ||
THE_PASSWORD="$1" | ||
else | ||
THE_PASSWORD="password" | ||
fi | ||
|
||
if [[ "$2" != "" ]] | ||
then | ||
DATABASE_NAME="$2" | ||
else | ||
DATABASE_NAME="develop" | ||
fi | ||
|
||
echo "mysql-server-5.5 mysql-server/root_password password "$THE_PASSWORD | debconf-set-selections | ||
echo "mysql-server-5.5 mysql-server/root_password_again password "$THE_PASSWORD | debconf-set-selections | ||
|
||
apt-get -y install mysql-server | ||
|
||
# remove limits on network adapter | ||
sed -i 's/bind-address/#bind-address/' /etc/mysql/my.cnf | ||
|
||
# replace key_buffer with key_buffer_size. key_buffer is deprecated (http://kb.parallels.com/en/120461) | ||
sed -i 's/key_buffer\s/key_buffer_size/' /etc/mysql/my.cnf | ||
|
||
# add standard config. | ||
cp /vagrant/conf/local.cnf /etc/mysql/conf.d/ | ||
|
||
sed -i 's/innodb_buffer_pool_size/#innodb_buffer_pool_size/' /etc/mysql/conf.d/local.cnf | ||
|
||
# create database | ||
|
||
header 'Creating Database: '$DATABASE_NAME | ||
|
||
echo "CREATE DATABASE "$DATABASE_NAME | mysql -uroot -p$THE_PASSWORD | ||
|
||
unset THE_PASSWORD | ||
unset DATABASE_NAME | ||
|
||
service mysql restart | ||
} | ||
|
||
function mysql_add_user() | ||
{ | ||
|
||
header 'Adding MySQL user: '$1 | ||
|
||
if [ "$3" != "" ] | ||
then | ||
THE_PASSWORD="$3" | ||
else | ||
THE_PASSWORD="password" | ||
fi | ||
|
||
if [[ "$4" != "" ]] | ||
then | ||
DATABASE_NAME="$4" | ||
else | ||
DATABASE_NAME="develop" | ||
fi | ||
|
||
echo "CREATE USER '"$1"'@'%' IDENTIFIED BY '"$2"';" | mysql -uroot -p$THE_PASSWORD | ||
echo "GRANT ALL PRIVILEGES ON "$DATABASE_NAME".* TO '"$1"'@'%' WITH GRANT OPTION;" | mysql -uroot -p$THE_PASSWORD | ||
|
||
# flush privilages | ||
echo "FLUSH PRIVILEGES;" | mysql -uroot -p$THE_PASSWORD | ||
|
||
unset THE_PASSWORD | ||
unset DATABASE_NAME | ||
} |