Guest User

Untitled

a guest
Jun 24th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. # download the image
  2. docker pull mysql/mysql-server:5.6
  3.  
  4. # run the image and assign it a name
  5. # left port can be changed. This is the one we will connect to in our local machine
  6. docker run -p 3306:3306 --name=mysql5.6 -d mysql/mysql-server:5.6
  7.  
  8. # check that the image is running correctly
  9. docker ps
  10.  
  11. # print the logs to look for the random password assigned to root user
  12. # is is usually in the form "[Entrypoint] GENERATED ROOT PASSWORD:..."
  13. docker logs mysql5.6
  14.  
  15. # connect to our new server (you will need to enter the password copied in the previous step)
  16. docker exec -it mysql5.6 mysql -uroot -p
  17.  
  18. # now inside the mysql console:
  19. #change root user password
  20. set password for root@localhost = PASSWORD(‘whatever’)
  21.  
  22. #create a new user to access all databases from outside the container
  23. create user foo@‘%’ idenfied by ‘foo’;
  24.  
  25. #grant all permisions to the new user
  26. grant all on *.* to foo@‘%’;
Add Comment
Please, Sign In to add comment