1049: Unknown database 'name'
MySQLWhat does it mean?
The database (schema) you are trying to connect to or use does not exist on the server. The USE statement or the default database name in the connection string points to a non-existent schema.
Why does it happen?
The database was never created, its name is misspelled (case sensitivity can vary by operating system), it was dropped, or the application is connecting to the wrong environment (dev/prod). Schemas not being migrated when moving to a new server is another common cause.
How to fix it
List the existing databases: SHOW DATABASES; Make sure the name is spelled correctly and the case matches (the lower_case_table_names setting matters). If it does not exist, create it: CREATE DATABASE database_name CHARACTER SET utf8mb4; or restore it from backup. Verify the target environment in the application's connection configuration.
More from this engine
- 1592ER_BINLOG_UNSAFE_STATEMENT: Unsafe statement written to the binary log
- 3140ER_INVALID_JSON_TEXT: Invalid JSON text
- 1526ER_NO_PARTITION_FOR_GIVEN_VALUE: Table has no partition for value
- 1364Field 'name' doesn't have a default value
- 1206The total number of locks exceeds the lock table size
- 1236Got fatal error 1236 from master when reading data from binary log
- 1129Host 'host' is blocked because of many connection errors