If you're seeing PDOException: SQLSTATE[HY000]  Can't connect to local MySQL server, it's because Drupal can't connect to the database server specified in your settings.php. There are two likely reasons for this:
- Your MySQL database server is not responding because it has crashed or been stopped. If you have shell access to your server and command-line knowledge, check to see if the MySQL process is running and accepting connections. It may need to be restarted. Check with your hosting company or system administrator to investigate. This can happen at any time, even if you haven't made any configuration changes.
- In many of the case, if no change done at server configuration or code level, there is possibility that Disk space of MySQL data partition is exhausted and almost fully utilized. To check quickly with df command
- The connection information you specified in settings.php is incorrect. Pay particular attention to the 'host' parameter as it instructs Drupal where to reach the database server. This is most likely to happen when you have moved the site to a new server or changed the server or database configuration.
- If you are running a localhost on a macbook pro your permissions could have gotten corrupted, and you are simply being denied access. Check other applications that may have strict permission requirements (such as a VPN). If those fail, you may need to use Disk Utility and rebuild or repair you permissions.