Godleydemon

mysql provision

Dec 7th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.77 KB | None | 0 0
  1. echo "installing mysql"
  2. sudo apt-get install -y mysql-server libapache2-mod-auth-mysql php5-mysql
  3. sudo mysql_install_db
  4. /usr/bin/mysql_secure_installation
  5.  
  6. echo "Configuring mysql to accept outside ip's"
  7. (grep -v "bind-address           = 127.0.0.1" /etc/mysql/my.cnf && echo "#bind-address           = 127.0.0.1") > /etc/mysql/my.cnf.1
  8.         ##Clean up Step
  9.         rm /etc/mysql/my.cnf
  10.         mv /etc/mysql/my.cnf.1 /etc/mysql/my.cnf
  11. read -p "Please enter mysql password: " password
  12. echo "You entered: $password continuing with install"
  13. mysql -uroot -p"$password" -e "use mysql"
  14. mysql -uroot -p"$password" -e "GRANT ALL ON *.* to root@'%' IDENTIFIED BY '$password';"
  15. mysql -uroot -p"$password" -e "FLUSH PRIVILEGES;"
  16.  
  17. service mysql restart
  18. ufw allow 3306
  19. ufw allow 80
Advertisement
Add Comment
Please, Sign In to add comment