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
org.postgresql.util.PSQLException: Connection refused (Connection refused)FATAL: password authentication failed for userFATAL: 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.

Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. 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. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) rayush33 rayush33 JavaScript (React.js, React Native, Node.js) Developer with demonstrated industry experience of 4+ years, actively looking for opportunities to hone my skills as well as help small-scale business owners with solutions to technical problems Kingsley Omage Kingsley Omage Fullstack software engineer passionate about AI Agents, blockchain, LLMs. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** 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

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