Users can get the MySQLdump 1049 unknown database phpmyadmin error when performing backups on WHM. The absence of the database in MySQL can be the probable reason for this. Today, in this article, we will learn about the reason why this error is caused and how it could be resolved permanently.
What are the grounds for the occurrence of “MySQLdump: got error :1049 :unknown database ” error?
With the aid of MySQLdump, you may create a collection of statements in SQL such as DML and DDL for recreated backup schema, as well as carry out logical backups in MySQL. To make a backup to a different SQL server, one or more databases are dumped. Output can be generated in XML format and CSV format.
However, there is a downside to using MySQLdump. If the database is huge, then the restoration process will probably take longer for execution. We will witness an error that will appear in the log and look like this:
The backup process on “hostname.example.server” encountered an error.
[2022-07-21 02:56:47 -0600] mysqldump: Got error: 1049: Unknown database ‘example_database’ when selecting the database
This issue points to the presence of the database in MySQL but not in the cPanel user database map.
What can be done to resolve the“MySQLdump: got error :1049 :unknown database ” error?
Now let us move on to the solution to this error. First, you must verify if the database is present within MySQL or not. This can be easily done by executing as the root user, the below-given command via SSH:
mysql -e “show databases;” | grep Exampleabc_database
You can replace the Exampleabc_database with the database that was mentioned in the backup log. The backup log can be found at /user/local/cpanel/logs/cpbackup.
After running the above-mentioned command, if there are no results, it shows that the database is absent in MySQL. Now to resolve this error, these absent databases must also be removed from the cPanel database map. To achieve this, we must log in to the cPanel account and look for the said database. Then move over to the Databases section. There click on the MySQL Databases option. And you can easily delete the said database from this database list. This will fix this error.
Now to conclude this article, we have successfully learned to resolve the “MySQLdump: got error :1049 :unknown database “ error. This error occurred while performing WHM backup. Understanding the cause of this error gave us a clear insight into how to resolve this error once and for all. Carefully following the solution mentioned above in the article will fix the MySQL error without fail.