Skip to content

Instantly share code, notes, and snippets.

@rogervila
Last active March 29, 2020 11:07
Show Gist options
  • Save rogervila/464e81f5992a55282e11a0a11b203cc0 to your computer and use it in GitHub Desktop.
Save rogervila/464e81f5992a55282e11a0a11b203cc0 to your computer and use it in GitHub Desktop.
Run MySQL with Docker
#!/usr/bin/env bash
echo -e "\\e[32mWait...\\e[0m"
docker network create -d bridge db || true
echo -e "\\e[32mDone! db network created\\e[0m"
echo -e "\\e[32mWait...\\e[0m"
docker run -d -p 3306:3306 --name mysql --restart always \
--network=db \
-e MYSQL_ROOT_PASSWORD=secret \
-v mysql_data:/var/lib/mysql \
mysql:8.0 \
--default-authentication-plugin=mysql_native_password
echo -e "\\e[32mDone! Mysql is running on 0.0.0.0:3306\\e[0m"
echo -e "\\e[32mWait...\\e[0m"
docker run -d -p 8080:80 --name phpmyadmin --restart always \
--network=db \
-e PMA_HOST=mysql \
-e MYSQL_ROOT_PASSWORD=secret \
-e PMA_USER=root \
-e PMA_PASSWORD=secret \
phpmyadmin/phpmyadmin:latest
echo -e "\\e[32mDone! PhpMyAdmin is running on 0.0.0.0:8080\\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment