Master in Data Analyst | Join Free Webinar on 15 Sep 2025 at 7 PM IST | Register for Free Demo

FATAL: database “dbname” does not exist

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
PostgreSQL database does not exist

FATAL: database “dbname” does not exist

🚨 PostgreSQL Database Does Not Exist – Error Explained

If you’ve ever tried connecting to PostgreSQL and seen the error:

FATAL: database "dbname" does not exist

 Why Does This Error Happen?

The PostgreSQL database does not exist error usually occurs because:

  • The database was never created.

  • You’re connecting with the wrong database name.

  • A script or application is pointing to a non-existing database.

  • The database was dropped accidentally.

5 Simple Fixes for PostgreSQL Database Does Not Exist Error
1. List all existing databases

Log in as a superuser and run:

\l

This shows all available databases.

2. Create the missing database

If the database isn’t listed, create it:

CREATE DATABASE dbname;
3. Assign ownership to the correct role
ALTER DATABASE dbname OWNER TO username;
4. Check your connection string

Make sure the application is connecting with the right database name:

psql -U username -d dbname -h localhost
5. Restore from backup (if dropped)

If the database was accidentally removed, restore it from a .dump or backup file:

psql -U username -d dbname < backup.sql

Conclusion

 At Learnomate Technologies, we’re here to support you every step of the way with top-notch training in PostgreSQL DBA and more.

For more detailed insights and tutorials, do check out our YouTube channelwww.youtube.com/@learnomate, where we regularly share practical tips and deep dives into essential database topics. And if you’re serious about mastering PostgreSQL DBA, head over to our website for our full training program: learnomate.org/training/postgresql-training/.

I’d love to connect with you, so don’t forget to follow my LinkedInhttps://www.linkedin.com/in/ankushthavali/. If you’re eager to read more about various technologies, explore our blog page here: https://learnomate.org/blogs/. Happy learning, and remember—tuning and training go hand-in-hand for database success!