Created
August 31, 2018 11:06
-
-
Save duffn/1c3cf0adadee1b746efc3665ba84d7cf to your computer and use it in GitHub Desktop.
MySQL in Docker with Buffalo
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
# MySQL in Docker | |
docker run --name=mysql01 -p 3306:3306 mysql/mysql-server:latest | |
docker exec -it mysql01 mysql -uroot -p | |
# Enter the one time password generated from the docker run command | |
# and then change the root password | |
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword'; | |
# Create a user with your host IP address so it can connect from Buffalo | |
# outside the container | |
create user 'root'@'172.17.0.1' with password 'mypassword'; | |
GRANT ALL PRIVILEGES ON * . * TO 'root'@'172.17.0.1'; | |
# database.yml looks like this | |
# Of course, you should be connecting with a different user in a real app. | |
development: | |
dialect: mysql | |
database: coke_development | |
user: root | |
password: mypassword | |
host: 127.0.0.1 | |
pool: 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there,
Does all of this just go into the database.yml or is the actual docker code supposed to reside elsewhere?
Thanks,
-MH