Skip to content

Instantly share code, notes, and snippets.

@bbrothers
Last active January 3, 2016 06:49
Show Gist options
  • Save bbrothers/8425394 to your computer and use it in GitHub Desktop.
Save bbrothers/8425394 to your computer and use it in GitHub Desktop.
Vagrant mysql script from fideloper / Vaprobash with permissions for remote access
#!/usr/bin/env bash
echo ">>> Setting MySQL Permissions"
[[ -z "$1" ]] && { echo "!!! MySQL root password not set. Check the Vagrant file."; exit 1; }
sudo sed -i '/^bind-address/s/bind-address.*=.*/bind-address = 0.0.0.0/' /etc/mysql/my.cnf
mysql -u root -p$1 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$1' WITH GRANT OPTION; FLUSH PRIVILEGES;"
sudo service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment