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
- CREATE DATABASE or create it in the hosting panel
- Fix the name (include the cPanel prefix)
- Verify host/port point to the right server
Detailed fix by platform
MySQL
SHOW DATABASES;
How to diagnose
- Name — Exact name?
- 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026