Make changes of wp-db.php file persistent against updates

Not a good idea to modify core WP files. Figure out the issue with the MySQL server dying: it’s going to be lack of good server configuration, a (very) bad quality host or a theme that is very database query-intensive.

Fixing the underlying cause of the database server errors is the best thing to do in the long run; hacking core files is a bad, temporary fix.