Replit database

PostgreSQL Connection Refused on Replit

Your application fails to connect to PostgreSQL with a connection refused error. The database service is either not running or your connection string is incorrect.

Replit's PostgreSQL requires the correct credentials, port, and hostname which vary between development and production.

Error Messages You Might See

org.postgresql.util.PSQLException: Connection refused (Connection refused) FATAL: password authentication failed for user FATAL: database does not exist

Common Causes

  1. PostgreSQL service not started in Replit
  2. Wrong hostname (localhost vs network hostname)
  3. Incorrect port number in connection string
  4. Missing or wrong database credentials
  5. Database doesn't exist yet (migration not run)

How to Fix It

Verify PostgreSQL is running via Replit's database panel. Use the auto-generated connection string from Replit secrets. For Spring Boot, ensure spring.datasource.url, username, and password are correctly set. Run database migrations on first deploy using Flyway or Liquibase.

Real developers can help you.

Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. Simon A. Simon A. I'm a backend developer building APIs, emulators, and interactive game systems. Professionally, I've developed Java/Spring reporting solutions, managed relational and NoSQL databases, and implemented CI/CD workflows. Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: 🚀 Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. 🏗️ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. ☁️ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. 📈 Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity. prajwalfullstack prajwalfullstack Hi Im a full stack developer, a vibe coded MVP to Market ready product, I'm here to help MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. Richard McSorley Richard McSorley Full-Stack Software Engineer with 8+ years building high-performance applications for enterprise clients. Shipped production systems at Walmart (4,000+ stores), Cigna (20M+ users), and Arkansas Blue Cross. 5 patents in retail/supply chain tech. Currently focused on AI integrations, automation tools, and TypeScript-first architectures. Victor Denisov Victor Denisov Developer Nam Tran Nam Tran 10 years as fullstack developer Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

How do I start PostgreSQL on Replit?

PostgreSQL auto-starts. Click the Database tab to verify it's running

Where's my PostgreSQL connection string?

In Replit Secrets as DATABASE_URL or similar. Copy it to your .env

Related Replit Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help