Warning, file /sdk/codevis/thirdparty/soci/scripts/vagrant/mysql.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/usr/bin/env bash
0002 # Part of Vagrant virtual development environments for SOCI
0003 
0004 # Installs MySQL with 'soci' user and database
0005 # Pre-installation
0006 source /vagrant/scripts/vagrant/common.env
0007 export DEBIAN_FRONTEND="noninteractive"
0008 sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password ${SOCI_PASS}"
0009 sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ${SOCI_PASS}"
0010 # Installation
0011 sudo apt-get -o Dpkg::Options::='--force-confnew' -y -q install \
0012   mysql-server
0013 # Post-installation
0014 echo "MySQL: updating /etc/mysql/my.cnf"
0015 sudo sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
0016 echo "MySQL: setting root password to ${SOCI_PASS}"
0017 mysql -uroot -p${SOCI_PASS} -e \
0018   "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${SOCI_PASS}' WITH GRANT OPTION; FLUSH PRIVILEGES;"
0019 echo "MySQL: creating user ${SOCI_USER}"
0020 mysql -uroot -p${SOCI_PASS} -e \
0021   "GRANT ALL PRIVILEGES ON ${SOCI_USER}.* TO '${SOCI_USER}'@'%' IDENTIFIED BY '${SOCI_PASS}' WITH GRANT OPTION"
0022 mysql -uroot -p${SOCI_PASS} -e "DROP DATABASE IF EXISTS ${SOCI_USER}"
0023 echo "MySQL: creating database ${SOCI_USER}"
0024 mysql -uroot -p${SOCI_PASS} -e "CREATE DATABASE ${SOCI_USER}"
0025 echo "MySQL: restarting"
0026 sudo service mysql restart
0027 echo "MySQL: DONE"