{"id":17023314,"date":"2023-09-04T07:53:30","date_gmt":"2023-09-04T07:53:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/intermittent-error-establishing-database-connection\/"},"modified":"2023-09-04T08:14:07","modified_gmt":"2023-09-04T08:14:07","slug":"intermittent-error-establishing-database-connection","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/intermittent-error-establishing-database-connection\/","title":{"rendered":"Intermittent &#8216;Error establishing database connection&#8217;"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Please can someone assist? I&#8217;m getting an error but it&#8217;s intermittent when I try and edit a product. The error is &#8216;Error establishing database connection&#8217;, when this appears I click on the browser back arrow and then I can edit. <br \/>I have done the following to try and resolve the issue<br \/><br \/><br \/>1 \u2013 Database credentials are correct: Checed wp-config.php for correct Database name, Database username, Database password, Database server. All is in order here<br \/><br \/>2 \u2013 Repair and optimise database \u2013 done and no errors found<br \/><br \/>3 \u2013 I have checked that the database is pointing to the web host, which it is. <br \/><br \/>4 \u2013 Check database server \u2013 successful. Server has enough connections. <br \/><br \/>5 \u2013 Check if plugins are the problem. Deactivated all plugins except WooCommerce and WordPress. Error still occurred. Reactivated plugins.<br \/><br \/>6 \u2013 Hosting provider suggested I install one or both of these plugins to pick up errors, Query Monitor and F12 Monitor. Query Monitor initially picked up backwpup with a line error so I deactivated this plugin.  F12 Monitor didn\u2019t show any errors.<br \/><br \/>Hosting provider also mentioned.<br \/>\u2018Error establishing a database connection means that the website created too many connections to it&#8217;s database at the same time. We have limited each database on shared servers to 10 concurrent database connections at the same time<br \/><br \/>As the error is intermittent, it most likely exceeded the 10 concurrent database connections while you are working on the site. This will especially happen when performing updates or opening several tabs to the site at one time. When an 11th connection is attempted, the error will occur. There is no way to increase this as your website is on a shared server.<br \/><br \/>Ideally, the database connections should only last a few milliseconds,I would advise optimising the database so that long running\/sleeping queries are properly closed\/terminated. \u2018<br \/><br \/>I have repaired and optimised the database.<br \/><br \/>I have also installed WP Super Cache <br \/><br \/>Today Query monitor is coming up with a Ajax:deprecated. I&#8217;m not sure what this means and how to fix it, but it wasn&#8217;t coming up initially<br \/><br \/>Please can someone assist?<br \/><\/p>\n","protected":false},"template":"","class_list":["post-17023314","topic","type-topic","status-publish","hentry","topic-tag-database-connection-error"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17023314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17023314\/revisions"}],"predecessor-version":[{"id":17023370,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17023314\/revisions\/17023370"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17023314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}