Unable to create a backup: Cannot connect to mysql localhost:3306 (database 'db_name')

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 12:55:11 UTC

Modified:

2016-12-21 19:32:10 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to create a backup: Cannot connect to mysql localhost:3306 (database 'db_name')

Symptoms

Backup creation fails with the following error:

Error:  mysql "db_name"

Cannot connect to mysql localhost:3306 (database 'db_name')

The following error appears in /usr/local/psa/PMM/sessions/YYYY-MM-DD-hhmmss.XXX/psadump.log :

DBI connect('dbname=db_name;host=localhost;port=3306','admin',...) failed: Unknown database 'db_name' at /usr/local/psa/PMM/agents/shared/Db/DbiBackend.pm line 47
ERROR 1049 (42000): Unknown database 'db_name'

Cause

The backup creation fails because db_name database does not exist in MySQL server, most likely it was removed not via Plesk interface, but via MySQL command line.

mysql> use db_name;
ERROR 1049 (42000): Unknown database 'db_name'

Resolution

In order to remove it properly from Plesk follow the steps:

  1. Create an empty database with db_name name via MySQL command line:

    mysql> create database <database_name>;
    Query OK, 1 row affected (0.00 sec)
  2. Remove it properly via Plesk interface under Home - Subscriptions - example.com - Websites & Domains - Databases

    Also you can remove a database using CLI utility /usr/local/psa/bin/database

    # /usr/local/psa/bin/database -r db_name

After that rerun backup creation task.

Have more questions? Submit a request
Please sign in to leave a comment.