WordPress: Error connecting to database again and again

Solution:

There is numerous problems that can lead to that issue.

Your issue is not permanent, so it looks like network issue or mysql side related problem.

Try to repair database, using STEP 3 from this tutorial

Add that line to wp-config.php

define(‘WP_ALLOW_REPAIR’, true);
Then go to http://www.yousite.com/wp-admin/maint/repair.php and follow dialog instructions as tutorial says.