Database Connection Issues
Troubleshoot database connectivity problems.
PostgreSQL Connection Refused
Symptom: ECONNREFUSED 127.0.0.1:5432
Fixes:
- Check PostgreSQL is running:
pg_isready - Verify
DB_HOSTandDB_PORTin.env - Check PostgreSQL
pg_hba.confallows connections
Authentication Failed
Symptom: password authentication failed for user
Fixes:
- Verify
DB_USERandDB_PASSin.env - Check user exists:
\duin psql - Reset password:
ALTER USER gauzy WITH PASSWORD 'new-password';
SSL Required
Symptom: no pg_hba.conf entry for host ... SSL off
Fix: Set SSL mode:
DB_SSL_MODE=true
Connection Pool Exhausted
Symptom: too many clients already or slow queries
Fixes:
- Increase pool size:
DB_POOL_SIZE=60 - Use PgBouncer for connection pooling
- Check for connection leaks (unclosed connections)
Migration Errors
Symptom: relation "xxx" does not exist
Fix:
# Run pending migrations
yarn typeorm migration:run
# Check migration status
yarn typeorm migration:show
SQLite Lock Errors
Symptom: SQLITE_BUSY: database is locked
Fix: SQLite doesn't support concurrent writes. For multi-user, switch to PostgreSQL:
DB_TYPE=postgres
Related Pages
- Database Backup & Recovery — backup guide
- Environment Variables — DB config