CentOS7にdockerでredashを構築して、localhostのMySQLに接続しようとしたところ、接続先名はlocalhost
ではつながらなかった。
docker上のredashとローカルのmysqlを連携させる
上記の記事によるとMacやWindowsだとhost.docker.internal
で接続できる。
How to connect locally hosted MySQL database with the docker container
上記の記事によると、Linuxだと172.18.0.1
で繋がる。
また、MySQL側もlocalhost以外で繋げるように、ユーザーの権限を172.18.0.1
または'%'で指定する必要がある。
grant all privileges on sample.* to testuser@'%';