Often while performing WHM backups, users notice an error “mysqldump: Got error: 1049: Unknown database”. This can happen when the database does not exist in MySQL.
As a part of our Server Management Services, we help our customers with similar requests related to WHM/ cPanel.
Let us today, discuss the possible reasons and fixes for this error.
What causes “MySQLdump: got error :1049 :unknown database ” error
MySQLdump helps to perform the logical backups, generating a set of SQL statements like DDL, DML for reproduced backup Schema. It dumps one or more MySQL databases for backup or transfers to another SQL server.
We can also generate output in CSV, other delimited text or XML format. The main drawback of MySQLdump is that the restoration procedure can take a long time to execute if the database is very large.
While performing WHM backups, at times, we can see the following error in the backup log:
The backup process encountered the following error: The backup process on “hostname.example.server” encountered an error. [2021-05-10 02:25:26 -0600] mysqldump: Got error: 1049: Unknown database ‘example_database’ when selecting the database
Generally, This error indicates that the related database exists in a cPanel user’s database map, but the database does not exist in MySQL.
How to fix “MySQLdump: got error :1049 :unknown database ” error
The first thing that our Support Engineers perform on seeing this error is to check whether the database exists within MySQL. They does this by running the following command as the root user via SSH:
mysql -e "show databases;" | grep example_database
Replace example_database with the database found within the backup error in the backup logs. We can find the backup logs within /usr/local/cpanel/logs/cpbackup.
If the above command does not display any results, it indicates that the database does not exist in MySQL.
Thus, In order to correct the backup errors, we have to remove the databases that do not actually exist in MySQL from cPanel.
For this, we initially log in to the cPanel account for the particular database user. Then, we navigate to the Databases section and then click on the MySQL Databases option.
Here, we just need to delete the corresponding database from the current database section.
[Need any further assistance to fix cPanel errors? – We’re available 24*7]
The “MySQLdump: got error :1049 :unknown database ” triggers while performing cPanel backups. This can happen when the database does not exist in MySQL. Today, we saw how our Support Engineers fix this error.