invoiceninja / dockerfiles

Docker files for Invoice Ninja
https://hub.docker.com/r/invoiceninja/invoiceninja
GNU General Public License v2.0
399 stars 263 forks source link

Invoice Ninja apps SQLSTATE[HY000] [2002] Connection refused errors #473

Closed aloychan closed 1 year ago

aloychan commented 1 year ago

The invoice ninja apps is throwing these error when trying to connect to the db.
I have tried numerous time following the steps but I cannot seem to get it running. Any help here would be appreciated.

Describe the bug log fills with this error and container restarts, this cycle repeats over and over again until the container exited.

To reproduce Steps to reproduce the behavior: Using the docker compose and env from Github

Expected behavior I expected the app to startup

Screenshots/logs If applicable, add screenshots to help explain your problem. In Connector.php line 70:

SQLSTATE[HY000] [2002] Connection refused

2022-11-18T00:34:10Z [ERROR] [Entrypoint]: Error connecting to DB 2022-11-18T00:34:28Z [INFO] [Entrypoint]: Initialising Invoice Ninja... INFO Configuration cached successfully.
INFO Caching the framework bootstrap files.
config .......................................................... 143ms DONE routes .......................................................... 335ms DONE In Connection.php line 760:

SQLSTATE[HY000] [1044] Access denied for user 'ninja'@'%' to database 'ninj
a' (SQL: select * from information_schema.tables where table_schema = ninja
and table_name = accounts and table_type = 'BASE TABLE')

In Connector.php line 70:

SQLSTATE[HY000] [1044] Access denied for user 'ninja'@'%' to database 'ninj
a'

2022-11-18T00:34:40Z [ERROR] [Entrypoint]: Error connecting to DB 2022-11-18T00:34:56Z [INFO] [Entrypoint]: Initialising Invoice Ninja... INFO Configuration cached successfully.

Output of docker version: Docker version 20.10.21, build baeda1f docker-compose version 1.29.2, build unknown

Additional context Add any other context about the problem here.

turbo124 commented 1 year ago
SQLSTATE[HY000] [1044] Access denied for user 'ninja'@'%' to database 'ninj
a'

this is the issue here.

aloychan commented 1 year ago

@turbo124 any way to address the issue. I have been trying all night and I cant seem to get it working. Tyvm

navanjr commented 1 year ago

Can you explain how this occurred when following the steps described in the README? I am seeing similar errors when deploying to a production environment. app and db services are restarting...

db_1      | 2023-03-10 18:34:59+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1      | 2023-03-10 18:34:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
app_1     | 
app_1     | In Connection.php line 760:
app_1     |                                                                                
app_1     |   SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_s  
app_1     |   chema.tables where table_schema = ninja and table_name = accounts and table  
app_1     |   _type = 'BASE TABLE')                                                        
app_1     |                                                                                
app_1     | 
app_1     | In Connector.php line 70:
app_1     |                                              
app_1     |   SQLSTATE[HY000] [2002] Connection refused  
app_1     |                                              
app_1     | 
app_1     | 2023-03-10T18:34:59Z [ERROR] [Entrypoint]: Error connecting to DB
db_1      | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
invoiceninja_app_1 exited with code 1
db_1      | 2023-03-10T18:35:00.699846Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
db_1      | 2023-03-10T18:35:00.724717Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32) starting as process 1
db_1      | 2023-03-10T18:35:00.871282Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
turbo124 commented 1 year ago

It looks like the mysql container has not started yet. The app continues to ping the mysql service until it comes up.