How to disable error messages to screen while mysql service is down Our production environment got a problem and the mysql service was down. The all our drupal based sites show the error messages below which expose to many information.


  PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL
  server through socket '/var/run/mysqld/mysqld.sock' (2) in
  lock_may_be_available() (line 164 of
  /home/workspace/drupal7/includes/lock.inc).


I find this page (via) about how to disable drupal errors, but have no effect when mysql is down.

Any one can give me a hand?
Having just run across the same issue, to avoid hacking the core files you can set the default error reporting level in your site's settings.php by adding the following line:

$conf['error_level'] = ERROR_REPORTING_HIDE;


Since the error_level variable is normally set from the database the setting otherwise defaults to DISPLAY_ALL if MySQL is down.

Note: this means the error level can no longer be configured through the admin interface (admin/config/development/logging).