Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codio-sql/setup.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
42 lines (32 sloc)
963 Bytes
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
#!/bin/bash | |
# SETUP SQL BOX | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
if [ -v CODIO_HOSTNAME ] | |
then | |
echo "Codio box detected" | |
echo "continuing setup" | |
else | |
echo "no Codio box detected" | |
echo "exiting setup" | |
exit 0 | |
fi | |
sudo chown -R codio:codio . | |
sudo apt update -y | |
sudo apt upgrade -y | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password p455w0rd' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password p455w0rd' | |
sudo apt -y install mysql-server mysql-client | |
echo "PS1='$ '" >> ~/.profile | |
echo "sudo /etc/init.d/mysql restart" >> ~/.profile | |
source ~/.profile | |
FILENAME="/etc/mysql/mysql.conf.d/mysqld.cnf" | |
SEARCH="127.0.0.1" | |
REPLACE="0.0.0.0" | |
sudo sed -i "s/$SEARCH/$REPLACE/gi" $FILENAME | |
SEARCH="[mysqld]" | |
REPLACE="[mysqld]\n\nsecure-file-priv=/home/codio/workspace" | |
sudo sed -i "s/$SEARCH/$REPLACE/gi" $FILENAME | |
# sudo chown -R mysql:mysql | |
sudo /etc/init.d/mysql restart |