{"id":7062,"date":"2021-08-05T10:06:48","date_gmt":"2021-08-05T04:36:48","guid":{"rendered":"https:\/\/www.skynats.com\/?p=7062"},"modified":"2024-12-11T13:15:12","modified_gmt":"2024-12-11T07:45:12","slug":"how-to-fix-database-error-connection-failed","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-fix-database-error-connection-failed\/","title":{"rendered":"How To Fix &#8220;Database Error Connection Failed&#8221; -Roundcube Cpanel"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Roundcube is a free, open-source webmail software, and Cpanel currently uses it as the default webmail client. Some of our clients have encountered the &#8220;Database Error Connection Failed&#8221; issue in Roundcube. If you&#8217;re facing this error, here&#8217;s how to fix the &#8220;Database Error Connection Failed&#8221; &#8211; <a href=\"https:\/\/docs.cpanel.net\/tags\/roundcube\/\" target=\"_blank\" rel=\"noopener\">Roundcube Cpanel<\/a> and get your webmail working again.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-causes-of-roundcube-database-error-connection-failed\">Causes of Roundcube &#8220;Database error connection failed&#8221; <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Roundcube uses MySQL or SQLite as the database type and it stores all the details like email users, contacts, address books, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So it will need the proper connection to the database, if the connection between the database and this application is not working well it will show this database error connection failed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"689\" height=\"250\" sizes=\"(max-width: 689px) 100vw, 689px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/roundcube-connection-failed-database-error-01612200061-1.png\" alt=\"Database Error Connection Failed\" class=\"wp-image-7063\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/roundcube-connection-failed-database-error-01612200061-1.png 689w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/roundcube-connection-failed-database-error-01612200061-1-300x109.png 300w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This error can be caused mainly because of the below reasons :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Database server is not running :<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">When the Mysql server is down the Roundcube can&#8217;t connect to its database and it produces the database connection failed error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. A corrupted Roundcube database :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL \/SQLite database with some missing data or tables with bugs can also cause this issue. In the Cpanel server, the details of all Cpanel domain&#8217;s emails are stored in a single Roundcube database and this also can make the database very huge. This also can cause a database connection failed error in Roundcube.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution :<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check MySQL connection :<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Check the MySQL database server status using the given command ;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service mysqld status<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If it is not running try to restart the MySQL service (You can also check the MySQL logs ).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Repair\/ Restore the Database :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we have to check the Roundcube database is accessible from the command line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u roundcube -p\nmysql&gt; show databases;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can check the tables in the Roundcube database using the below command ;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql &gt; show tables;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If all the tables are present there then you can repair the Roundcube database as below. (Take a backup for the database for safety)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysqlcheck -r roundcube<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Roundcube can be rebuild from the command line using this command. (You can do this if the database or table is missing and it will rebuild the Roundcube database)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/cpanel\/bin\/update-roundcube --force<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you have the latest database backup available for Roundcube then you can restore the Roundcube database backup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql roundcube &lt; roundcube.sql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can then remove the existing Roundcube database after the restoration of the database from the latest backup (Take a backup of the existing Roundcube database for a safety measure).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can drop the existing database using ;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql &gt; drop database roundcube_old;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Convert To SQLite Database type :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you face this issue only with MySQL database then you can try to switch the Roundcube database to SQLite. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As of Cpanel 11.4.x, Roundcube only supports SQLite.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pros for using SQLite for Roundcube : <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster than MySQL.<\/li>\n\n\n\n<li>SQLite databases are stored in user accounts and so it considers user&#8217;s disk space usage.<\/li>\n\n\n\n<li>Easy to restore Roundcube data from the backups on a per-user basics.<\/li>\n\n\n\n<li>Easier to identify problamatic Webmail users.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Cpanel provides scripts to switch Roundcube to use the SQLite database type. You must take a backup of the current database prior to the conversion to SQLite database.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/scripts\/convert_roundcube_mysql2sqlite<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you need to convert Roundcube for a specific user use this command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/scripts\/convert_roundcube_mysql2sqlite &lt;user&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;If you&#8217;re still facing the &#8216;Database Error Connection Failed&#8217; in Roundcube, don&#8217;t worry. Our <a href=\"https:\/\/www.skynats.com\/blog\/\">technical team<\/a> is here to help you quickly fix &#8216;Database Error Connection Failed&#8217; &#8211; Roundcube Cpanel and get your system running smoothly.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Roundcube is a free, open-source webmail software, and Cpanel currently uses it as the default webmail client. Some of our clients have encountered the &#8220;Database Error Connection Failed&#8221; issue in Roundcube. If you&#8217;re facing this error, here&#8217;s how to fix the &#8220;Database Error Connection Failed&#8221; &#8211; Roundcube Cpanel and get your webmail working again. Causes [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,300],"tags":[616],"class_list":["post-7062","post","type-post","status-publish","format-standard","hentry","category-blog","category-database","tag-database-error"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/7062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=7062"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/7062\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=7062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=7062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=7062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}