Skip to content

Instantly share code, notes, and snippets.

@micimize
Last active October 17, 2015 15:49
Show Gist options
  • Save micimize/16c9535a2e0feb9c4e30 to your computer and use it in GitHub Desktop.
Save micimize/16c9535a2e0feb9c4e30 to your computer and use it in GitHub Desktop.
docker -> brewed mysql
vim /usr/local/Cellar/mysql/5.6.21/homebrew.mxcl.mysql.plist # add the --bind-address
# <key>ProgramArguments</key>
# <array>
# <string>/usr/local/opt/mysql/bin/mysqld_safe</string>
# <string>--bind-address=0.0.0.0</string>
# <string>--datadir=/usr/local/var/mysql</string>
# </array>
mysql.server restart
tail -f /usr/local/var/mysql/$USER.local.err # verify bound address, check for 'could not be resolved'
mysql > GRANT ALL PRIVILEGES ON database.* TO 'root'@'%' identified by 'pass';
mysql > flush privileges;
docker run --name container -P -e ENVIRONMENT=DEV \
--add-host=local:$(ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}') \
-p 8080:80 -p 3306:3306 -it image /bin/bash # image with mysql
mysql -h local -u root -ppass database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment