PDOException: SQLSTATE[HY000] [2002] No such file or directory in lock_may_be_available() (line 167 I have Drupal 7.2 application site and have upgraded from php 5.6 to php 7.2 since it reached its eol, also upgraded to rhel 8 from rhel 6.5, but while connecting to rds I am getting following error, however while trying to connect to db locally, was able to connect successfully. What does this mean and How can I solve this
lock_may_be_available() is the first call that Drupal makes, in order to try a connection with the database. Then, the first idea seems that is not unable connect to your database so your mysql isn't running well or better, your Drupal can't connect to your MySQL server. Ok. 

The next step is think'bout the reasons:

1- In some cases, it's just due to use "localhost" instead of 127.0.0.1 in your settings.php or local.settings.php file. Review this in the database config block:

$databases['default']['default'] = [
  'database' =&gt; 'db_name',
  'username' =&gt; 'db_user',
  'password' =&gt; 'db_password',
  'host' =&gt; '127.0.0.1',
  'driver' =&gt; 'mysql',
  'port' =&gt; 3306,
  'prefix' =&gt; "",
 ];


In some cases using Containers (Docker, DDEV, etc) may be necessary change as: 'host' =&gt; 'localhost', to 'host' =&gt; 'mariadb',. 

2- Maybe the MySQL daemon is crashing. Stop the daemon and restart it. You can use:       /etc/init.d/mysqld restart
or:  service mysqld restart // service mysql restart.

3- If you're using some special kind of configuration as multisite, multidomain, etc, then get some of log info from your system, using: tail -f /var/log/mysql/error.log