Horde webmail gives an error: DB Error: connect failed

Created:

2016-11-16 13:17:39 UTC

Modified:

2017-04-24 11:31:22 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Horde webmail gives an error: DB Error: connect failed

Applicable to:

  • Plesk 10.4 for Windows
  • Plesk 11.0 for Windows
  • Plesk 11.0 for Linux
  • Plesk 12.0 for Linux
  • Plesk 10.x and below for Linux
  • Plesk 9.x and below for Windows

Symptoms

While logging in to Horde webmail, the following appears:

    A fatal error has occurred
DB Error: connect failed
Details have been logged for the administrator.

Cause

Such an error occurs when Horde cannot connect to database storage. On Plesk server, Horde is integrated with client MySQL server. The exact reason cannot be determined using Horde log file %SystemRoot%\Temp\horde.log . Possible reasons are listed below:

In C:\Windows\Temp\horde.log , you see an error similar to:

  1. MySQL server is down:

    HORDE [emergency] [horde] DB Error: connect failed:  [nativecode=Can't connect to MySQL server on 'localhost' (10061)] ** Array [on line 1259 of "C:\\Inetpub\\vhosts\\webmail\\horde\\lib\\Horde\\DataTree\\sql.php"]
  2. The server 'servername' is invalid or does not exist:

    HORDE [emergency] [horde] DB Error: connect failed:  [nativecode=Unknown MySQL Server Host 'servername' (11004)] ** Array [on line 1259 of "C:\\Inetpub\\vhosts\\webmail\\horde\\lib\\Horde\\DataTree\\sql.php"]
  3. The credentials for MySQL server are incorrect:

    HORDE [emergency] [horde] DB Error: connect failed:  [nativecode=Access denied for user 'horde'@'localhost' (using password: YES)] ** Array [on line 1259 of "C:\\Inetpub\\vhosts\\webmail\\horde\\lib\\Horde\\DataTree\\sql.php"]
  4. The Horde database does not exist:

    HORDE [emergency] [horde] DB Error: no such database:  [nativecode=Unknown database 'horde'] ** Array [on line 1259 of "C:\\Inetpub\\vhosts\\webmail\\horde\\lib\\Horde\\DataTree\\sql.php"]

Resolution

You need look at the the Horde configuration file %plesk_vhosts%webmail\horde\config\conf.php

Find $conf['sql'] section. Check the following variables:

    $conf['sql']['phptype'] – type of SQL server 
$conf['sql']['port'] – port for connection
$conf['sql']['protocol'] – protocol for connection
$conf['sql']['hostspec'] – SQL server IP address or FQDN
$conf['sql']['username'] – SQL user for horde authentication
$conf['sql']['password'] – SQL user password
$conf['sql']['database'] – horde database in SQL server
$conf['sql']['charset'] – MySQL character set

Example of $conf['sql'] section.

    $conf['sql']['phptype'] = 'mysql';
$conf['sql']['port'] = 3306;
$conf['sql']['protocol'] = 'tcp';
$conf['sql']['hostspec'] = 'localhost';
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = 'webmail639';
$conf['sql']['database'] = 'horde';
$conf['sql']['charset'] = 'utf-8';
  1. Check MySQL server in $conf['sql']['hostspec'] . It should be up and running. If it is not, open ' services.msc ' console and start MySQL Server service (set its startup type to Automatic ).

  2. Specify correct server address in $conf['sql']['hostspec'] .

  3. Configure $conf['sql']['username'] and $conf['sql']['password'] for MySQL server. To do so, connect to $conf['sql']['hostspec']: $conf['sql']['port'] (e.g. localhost:3306) as SQL server administrator and perform the following queries:

    mysql> REPLACE INTO `mysql`.`user` VALUES ('%','horde',password('password'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);

    mysql> REPLACE INTO `mysql`.`tables_priv` VALUES ('%','horde','horde','horde_users','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','horde_prefs','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','horde_datatree','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','horde_datatree_attributes','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','horde_tokens','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','horde_vfs','root@localhost','2006-07-19 12:15:26','Select,Insert,Update,Delete',''),('%','horde','horde','turba_objects','root@localhost','2006-07-19 12:15:27','Select,Insert,Update,Delete','');

    mysql> FLUSH PRIVILEGES;

(the password should be equal to $conf['sql']['password'] ).

4\. Recreate the Horde database. It can be done using a query in the attached file: horde.zip . MySQL administrator privileges are required for it.

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