1049 🐬 MySQL

MySQL ERROR 1049 (42000): Unknown database 'x'

The database named in the connection doesn’t exist on that server.

Seen on: MySQL

Meaning

Typos, case sensitivity on Linux, connecting to the wrong server/environment, or the database was never created.

Common causes

  • Database not created
  • Typo/case mismatch in DB_DATABASE
  • Connected to a different server (local vs production)
  • Shared hosting prefix missing (user_dbname)

⚡ Quick fix

  1. CREATE DATABASE or create it in the hosting panel
  2. Fix the name (include the cPanel prefix)
  3. Verify host/port point to the right server

Detailed fix by platform

MySQL

  1. SHOW DATABASES;

How to diagnose

  1. Name — Exact name?
  2. Server — Right host?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.