Back to home

MySQL Development With Docker main image

MySQL Development With Docker

Firstly, pull docker pull mysql/mysql-server.

Then docker run --name sql-test -e MYSQL_ROOT_PASSWORD=password -p 6000:3306 -d mysql/mysql-server:latest. If there a replacement or commited image, run that instead.

If you are running it on a network, first create the network docker network create dev-env, then run with the --net flag to hook it up.

docker run --name sql-test -e MYSQL_ROOT_PASSWORD=password -p 6000:3306 --net dev-env -d mysql/mysql-server:latest.

Linking docker run -d -name app-container-name --link mysql-container-name app-image-name.

Updating the local Docker MySQL instance

Log into the container and first log into mysql using mysql -u root -p. This will prompt you for that password we created, so now type that in and enter the command line terminal. First, run CREATE USER 'admin'@'%' IDENTIFIED BY 'password'; Run GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;. Finally, run FLUSH PRIVILEGES;.

Personal image

Dennis O'Keeffe

@dennisokeeffe92
  • Melbourne, Australia

Hi, I am a professional Software Engineer. Formerly of Culture Amp, UsabilityHub, Present Company and NightGuru.
I am currently working on Visibuild.

1,200+ PEOPLE ALREADY JOINED ❤️️

Get fresh posts + news direct to your inbox.

No spam. We only send you relevant content.