Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matomo fails to connect to mysql when both in docker container in MAC, mySQL is accessible otherwise #13771

Closed
kkostenko opened this issue Nov 27, 2018 · 3 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@kkostenko
Copy link

Hello!

I have both matomo and mysql running in docker containers on my MacBook the following way:
docker run --name mysql_matomo -p 3306:3306 -p 33060:33060 -e MYSQL_ROOT_PASSWORD=supersecretpassword -d mysql
docker run -d --link mysql_matomo --name matomo -p 80:80 -p 443:443 matomo

mySQL is accessible just fine from mySQL Workbench on the same MAC.
I created piwik DB on mySQL successfully.

However, during matomo installation process if I use 127.0.0.1 address for DB server I gets the following error:
Error while trying to connect to the database server: SQLSTATE[HY000] [2002] Connection refused
If I use "localhost", I am getting another one:
Error while trying to connect to the database server: SQLSTATE[HY000] [2002] No such file or directory

Any idea what can be wrong here?

@fdellwing
Copy link
Contributor

SQLSTATE[HY000] [2002] Connection refused

This hints, that you are indeed able to reach the server, but it is not allowing the access. So, the next logical step would be to check the log of the mysql server for the reason it does not allow the connection.

@kkostenko
Copy link
Author

well, as I mentioned, I can access mySQL server otherwise, only matomo fails to do though. The logs are not helpful:
$docker logs 7ad7364fdb57 | tail
2018-11-27T13:40:26.881387Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881471Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881505Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881538Z 0 [Warning] [MY-010315] [Server] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881602Z 0 [Warning] [MY-010323] [Server] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881627Z 0 [Warning] [MY-010323] [Server] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.881695Z 0 [Warning] [MY-010311] [Server] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.886696Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.886767Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-11-27T13:40:26.895641Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.13' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2018-11-27T13:40:26.985330Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
Initializing database
Database initialized
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...

MySQL init process done. Ready for start up.

$

@kkostenko
Copy link
Author

ok, I figured it out. Instead of 127.0.0.1 I need to use a real IP of the MAC host. Otherwise matomo/piwik tries to access a service within matomo container looks like.

@Findus23 Findus23 added the answered For when a question was asked and we referred to forum or answered it. label Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants