Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ``` bash
- $ docker run --name mysql-c1 -d -v /workspace/docking:/workspace/docking mysql/mysql-server
- ```
- Remember to wait for a few seconds and then continue.
- ``` bash
- $ docker logs mysql-c1 2>&1 | grep GENERATED # On Windows it's "findstr" instead of "grep"
- # Copy that password from output: e.g. GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
- $ docker exec -it mysql-c1 mysql -u root -p
- # [Enter Password]
- ```
- ``` sql
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
- mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpassword' WITH GRANT OPTION;
- - e.g. Create WordPress DB
- mysql> CREATE DATABASE gourmet CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
- mysql> exit
- ```
- ``` bash
- bash-4.2# exit
- # After exiting to host machine, you may inspect the container id.
- $ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql-c1
- ```
Add Comment
Please, Sign In to add comment