[Docker] mysql_server and phpmyadmin

Jameskrauser Lee
2 min readJun 1, 2018

--

step1.
install mysql

docker pull mysql/mysql-server

run Mysql

docker run — name mysql3 -e MYSQL_ROOT_PASSWORD=abc -d mysql/mysql-server:5.7

step2.
install phpmyadin and link with mysql3

docker pull phpmyadmin/phpmyadmindocker run — name myadmin -d — link mysql3:db -p 9100:80 phpmyadmin/phpmyadmin

step3.
login mysql to update root’s

docker exec -it mysql3 mysql -u root -p

in Mysql >

use mysql;
update user set host = ‘%’ where user = ‘root’;
flush privileges;

step4.
http://localhost:9100/index.php
now you can login

step5.
how to save your container’s change to images

sudo docker ps -lsudo docker commit <container_id> yourSaveName

run the save Container

sudo docker run yourSaveName

PS:
Docker : Error response from daemon: Conflict. The Container name “/XXX” is already in use by container.

solution:

docker stop xxx; //xxx is your container names
docker rm xxx;

if you want to install on Win8 , you can’t install docker , you need docker toolbox

Ref data
http://www.andrewchen.tw/2017/05/05/20170505_NOTE_DOCKER_MYSQL/

https://stackoverflow.com/questions/19585028/i-lose-my-data-when-the-container-exits

--

--

Jameskrauser Lee
Jameskrauser Lee

Written by Jameskrauser Lee

For the last few years. i was involved mostly in the development of Automatic Fare collection system for the Chennai Metro. Familiar with C++ and iOS.

No responses yet