Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ``` bash
  2. $ docker run --name mysql-c1 -d -v /workspace/docking:/workspace/docking mysql/mysql-server
  3. ```
  4.  
  5. Remember to wait for a few seconds and then continue.
  6.  
  7. ``` bash
  8. $ docker logs mysql-c1 2>&1 | grep GENERATED # On Windows it's "findstr" instead of "grep"
  9. # Copy that password from output: e.g. GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
  10. $ docker exec -it mysql-c1 mysql -u root -p
  11. # [Enter Password]
  12. ```
  13. ``` sql
  14. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
  15. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpassword' WITH GRANT OPTION;
  16.  
  17. - e.g. Create WordPress DB
  18. mysql> CREATE DATABASE gourmet CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  19. mysql> exit
  20. ```
  21.  
  22. ``` bash
  23. bash-4.2# exit
  24. # After exiting to host machine, you may inspect the container id.
  25. $ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql-c1
  26. ```
Add Comment
Please, Sign In to add comment