{"id":3642,"date":"2019-02-22T14:53:45","date_gmt":"2019-02-22T09:23:45","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=3642"},"modified":"2026-10-09T13:03:07","modified_gmt":"2026-10-09T07:33:07","slug":"roundcube-database-error-connection-failed","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/roundcube-database-error-connection-failed\/","title":{"rendered":"How to Fix Roundcube \u201cDatabase Error: Connection Failed\u201d in VestaCP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong><strong>Post Dat<\/strong>e:<\/strong> February 22, 2019<br><strong>Last Updated:<\/strong> October 09, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.roundcube.net\/doc\/help\/1.1\/en_US\/\" target=\"_blank\" rel=\"noopener\">Roundcube <\/a>is a web-based email client that allows users to access and manage their email accounts through a browser. It is commonly deployed with <a href=\"https:\/\/www.postfix.org\/BASIC_CONFIGURATION_README.html\" target=\"_blank\" rel=\"noopener\">Postfix<\/a>, <a href=\"https:\/\/doc.dovecot.org\/latest\/core\/config\/namespaces.html\" target=\"_blank\" rel=\"noopener\">Dovecot<\/a>, and a database backend.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After installing <a href=\"https:\/\/vestacp.com\/docs\/how-to-properly-set-up-a-mail-server\" target=\"_blank\" rel=\"noopener\">VestaCP <\/a>on Ubuntu, you may encounter the following error when opening Roundcube:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>DATABASE ERROR: CONNECTION FAILED<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One possible cause, particularly in the older VestaCP installations described in this guide, is a Dovecot configuration conflict. The related log message may be:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Error: User initialization failed: namespace configuration error: Duplicate namespace prefix: \"\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This indicates that Dovecot is encountering conflicting namespace definitions. Dovecot namespaces define how mail folders such as INBOX and Sent are presented to email clients.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to inspect the configuration, identify duplicate namespace settings, apply the appropriate fix, and verify that the mail services work correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Symptoms of the Problem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You may experience one or more of the following symptoms:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Roundcube displays \u201cDATABASE ERROR: CONNECTION FAILED.\u201d<\/li>\n\n\n\n<li>Webmail login fails or does not load correctly.<\/li>\n\n\n\n<li>Dovecot logs report a duplicate namespace prefix.<\/li>\n\n\n\n<li>IMAP authentication or mailbox initialization fails.<\/li>\n\n\n\n<li>The problem appears after a fresh VestaCP installation or a configuration change.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Important:<\/strong> A Roundcube database connection error can also result from incorrect database credentials, unavailable PostgreSQL\/MySQL services, or network connectivity problems. Check the logs before assuming Dovecot is the cause.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Root Cause<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dovecot uses namespaces to organize mail folders. In the reported VestaCP configuration, the default inbox namespace was already defined in <code>\/etc\/dovecot\/dovecot.conf<\/code>, while another configuration file, <code>\/etc\/dovecot\/conf.d\/15-mailboxes.conf<\/code>, was suspected of introducing a conflicting definition.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When namespace definitions conflict, Dovecot may fail to initialize a user&#8217;s mailbox.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dovecot documentation explains that namespaces have prefixes and that the empty prefix is commonly used for the default namespace. Only one namespace can be designated as the inbox namespace with <code>inbox = yes<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Solution<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Check the Dovecot service<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status dovecot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check recent service logs:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u dovecot -n 50 --no-pager<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Look for messages containing <code>Duplicate namespace prefix<\/code> or other configuration errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Inspect the namespace configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check the main configuration file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">grep -n -A15 -B5 'namespace' \/etc\/dovecot\/dovecot.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the additional mailbox configuration:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cat \/etc\/dovecot\/conf.d\/15-mailboxes.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check which configuration files are included:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">grep -n '15-mailboxes.conf' \/etc\/dovecot\/dovecot.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dovecot&#8217;s effective configuration can also be inspected with:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">doveconf -n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Back up the configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before changing any settings, create a backup:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cp -a \/etc\/dovecot\/dovecot.conf \\\n  \/etc\/dovecot\/dovecot.conf.bak\n\ncp -a \/etc\/dovecot\/conf.d\/15-mailboxes.conf \\\n  \/etc\/dovecot\/15-mailboxes.conf.bak<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Correct the duplicate namespace definition<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the logs and configuration confirm that <code>15-mailboxes.conf<\/code> is being included and introduces the conflicting namespace, remove the duplicate definition or disable the relevant include.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The original workaround for the affected VestaCP installation was to remove the reference to:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/etc\/dovecot\/conf.d\/15-mailboxes.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do not remove the file or disable its include without confirming its contents and purpose.<\/strong> It may contain valid mailbox settings required by your installation. Preserve the existing mailbox configuration and ensure that exactly one appropriate default inbox namespace is defined.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Validate the configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">doveconf -n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Review the output for duplicate namespace definitions and configuration errors. If the configuration is invalid, restore the backup or correct the conflicting settings before restarting the service.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Restart Dovecot<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After correcting the configuration, restart the service:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl restart dovecot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that it is running:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status dovecot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Review the latest logs:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u dovecot -n 50 --no-pager<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Verify Roundcube and database connectivity<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open Roundcube in your browser and try logging in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the error remains, check the Roundcube configuration and logs. Confirm that the configured database host, port, database name, username, and password are correct. Verify that the database service is reachable from the Roundcube server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For installations using an external PostgreSQL server, test connectivity with the appropriate PostgreSQL client and confirm that the database permits connections from the Roundcube server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also check the web server and PHP logs for additional errors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting Flow Map<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following flow to identify the cause of the failure:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"936\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1-1024x936.png\" alt=\"\" class=\"wp-image-12209\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1-1024x936.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1-300x274.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1-768x702.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/Roundcube-Webmail-Troubleshooting-Flowchart-1.png 1312w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Roundcube \u201cDATABASE ERROR: CONNECTION FAILED\u201d message can have several causes. In the older VestaCP scenario covered here, a duplicate Dovecot namespace definition was a suspected cause of the failure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the Dovecot logs, identify the conflicting namespace, back up the configuration, and validate the corrected settings before restarting the service. If the error continues, investigate Roundcube&#8217;s database connection separately.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Following these steps helps administrators troubleshoot webmail failures systematically while reducing the risk of disrupting existing email services.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Why does Roundcube show \u201cDATABASE ERROR: CONNECTION FAILED\u201d?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This message indicates a database connection problem reported by Roundcube. Possible causes include incorrect database credentials, an unavailable database, network restrictions, or a related mail-server configuration problem. Check the logs to determine the actual cause.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. What does \u201cDuplicate namespace prefix: &#8220;&#8221;\u201d mean?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It means Dovecot has encountered conflicting namespace definitions using the same empty prefix. Inspect the active namespace configuration and ensure that the default inbox namespace is configured correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Is it safe to remove <code>15-mailboxes.conf<\/code>?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Not in every installation. The file may contain valid mailbox definitions. First inspect the file and the main Dovecot configuration, then remove or disable only the conflicting configuration. Back up the files before making changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/find-roundcube-version-provided-by-the-cpanel-and-upgrade-the-roundcube\/\">Find roundcube version provided by the cPanel and upgrade the roundcube<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/disable-server-in-roundcube-login-page\/\">Disable server in roundcube login page<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Have a technology challenge or looking for the right solution for your business? Our team can help you with <strong>cloud, DevOps, development, infrastructure, design, and more<\/strong>. Feel free to reach out to our experts <a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: February 22, 2019Last Updated: October 09, 2026 Introduction Roundcube is a web-based email client that allows users to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[560,344,188],"class_list":["post-3642","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-roundc","tag-vestacp","tag-webmail","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-WK","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3642"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3642\/revisions"}],"predecessor-version":[{"id":12210,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3642\/revisions\/12210"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}