error establishing a database connection 3

I too had faced the same issue many times but after refreshing the browser it solved my problem.

Kindly check the wp-config file and verify if the database name and other information is correct.

Another thing you can try is restarting your local host.