Closed rjanossy closed 2 years ago
Port 3399 = host port Port 3306 = port inside docker Conclusion: adjust your DATABASE_URL
THX Kevin,
Do you mean DATABASE_URL=mysql://kimai:kimai@127.0.0.1:3306/kimai ?
This gives the same error: Testing DB:* new \PDO(mysql:host=127.0.0.1;dbname=kimai;port=3306, kimai, kimai, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
Robert
Solved!
I had to use the mysql -container-ip 172.17.0.3
docker run --rm --name kimai-test -ti -p 8001:8001 -e DATABASE_URL=mysql://kimai:kimai@172.17.0.3:3306/kimai kimai/kimai2:apache
Thank you Kevin! Robert
hello, how do u fix this, how do u "use mysql -container-ip 172.17.0.5"?
Is this using docker compose or running dockers individually?
inivdually
Hi, After starting the mysql container:
docker run --rm --name kimai-mysql-testing -e MYSQL_DATABASE=kimai -e MYSQL_USER=kimai -e MYSQL_PASSWORD=kimai -e MYSQL_ROOT_PASSWORD=kimai -p 3399:3306 -d mysql
I can connect to the mysql server like this :
mysql --host=127.0.0.1 --port=3399 -u kimai -p
and I see the kimai database
+--------------------+ | Database
+--------------------+ | information_schema | | kimai | +--------------------+ 2 rows in set (0.03 sec)
But when I try to start kimai/kima2:
docker run --rm --name kimai-test -ti -p 8001:8001 -e DATABASE_URL=mysql://kimai:kimai@127.0.0.1:3399/kimai kimai/kimai2:apache
I get this error:
Testing DB:* new \PDO(mysql:host=127.0.0.1;dbname=kimai;port=3399, kimai, kimai, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] Connection refused (?)Checking DB: 10
If I try with localhost instead of 127.0.0.1 I get different error:
Testing DB:* new \PDO(mysql:host=localhost;dbname=kimai;port=3399, kimai, kimai, [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ]);SQLSTATE[HY000] [2002] No such file or directory (?)Checking DB: 10
Any help would be greatly appreciated. Robert