Skip to content

Instantly share code, notes, and snippets.

@duffn
Created August 31, 2018 11:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duffn/1c3cf0adadee1b746efc3665ba84d7cf to your computer and use it in GitHub Desktop.
Save duffn/1c3cf0adadee1b746efc3665ba84d7cf to your computer and use it in GitHub Desktop.
MySQL in Docker with Buffalo
# 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
@MostHated
Copy link

Hey there,
Does all of this just go into the database.yml or is the actual docker code supposed to reside elsewhere?

Thanks,
-MH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment