2

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:

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

and

-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:

[mysqld]

bind-address = 0.0.0.0

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.

Brandon
  • 7,736
  • 9
  • 47
  • 72
  • Based on http://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist, you need to login to the container (`docker exec -it mysql-csm /bin/bash`) and run the upgrade command, and then stop and restart the container. Likely the MySQL version in your container is newer than the previous host version. Backup your database first in case anything goes wrong. – Xiongbing Jin Mar 16 '16 at 14:50
  • amazing. the problem for me when i read that instruction originally was I thought it was adjusting the MySQL server software, which I wasn't sure how to do w/in a docker. now i realize it was adjusting my DB file, so being in a docker doesn't matter--took less than 2 minutes. if you submit this as an answer, i'll mark it as accepted, and thank! – Brandon Mar 16 '16 at 19:54

0 Answers0