Connecting to Dockerized MySQL from remote client

tl;dr: database used to be connectable from remote, but after dockerizing it, it isn’t (though i can access from host).

I’ve set up a docker container running MySQL in an ec2 instance, using the following command:

  • How do you handle nontrivial environment differences with docker?
  • auto nginx proxy for dockerized websites
  • Getting an error while trying to use a command under the lifecycle tag on kubernetes
  • Getting a “can't stat” error on build when trying to build a docker container within a Jenkins pipeline, but why?
  • Docker stack deploy rolling updates volume issue
  • Starting and stopping App Engine instances with Docker
  • sudo docker run --name mysql-csm -p 3306:3306 -v /db/mysql:/var/lib/mysql -v /db/mysql-config:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=password -d mysql

    where: -v /db/mysql:/var/lib/mysql maps my host’s database to the docker


    -v /db/mysql-config:/etc/mysql/conf.d maps my host custom config file to the dockerized MySQL config. the host file is supposed to take precedent, and my custom config contains one line:

    bind-address =

    I am able to connect to the database via host command-line using the following:

    sudo docker run -it --link mysql-csm:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -u"user" -p"pw"'

    From the MySQL command-line, all of the tables, etc., are present & look good. This database ran in a regular MySQL version previously, and I could connect remotely.

    However, when trying to connect from my laptop using MySQL Workbench, I receive the error:

    Table 'performance_schema.session_variables' doesn't exist

    Googling suggests it’s something to do with upgrading, but I’m not sure how to address that.

    ETA: I get the same error when trying to login thru SSH -> TCP/IP via MySQL Workbench.

  • Rundeck is not showing docker containers in nodes
  • Need to install Perl AND Linux
  • running three processes in docker and last .py file not found not found
  • Docker database files: inside or outside the container?
  • linux mke2fs failed: there's no device named /dev/ram0 inside my docker image
  • File Not Found when running Laravel with Nginx using LaraDock
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.