Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # download the image
- docker pull mysql/mysql-server:5.6
- # run the image and assign it a name
- # left port can be changed. This is the one we will connect to in our local machine
- docker run -p 3306:3306 --name=mysql5.6 -d mysql/mysql-server:5.6
- # check that the image is running correctly
- docker ps
- # print the logs to look for the random password assigned to root user
- # is is usually in the form "[Entrypoint] GENERATED ROOT PASSWORD:..."
- docker logs mysql5.6
- # connect to our new server (you will need to enter the password copied in the previous step)
- docker exec -it mysql5.6 mysql -uroot -p
- # now inside the mysql console:
- #change root user password
- set password for root@localhost = PASSWORD(‘whatever’)
- #create a new user to access all databases from outside the container
- create user foo@‘%’ idenfied by ‘foo’;
- #grant all permisions to the new user
- grant all on *.* to foo@‘%’;
Add Comment
Please, Sign In to add comment