I had a task of creating some general front end updates for a wordpress site.
A simple task of setting up the site locally caused headache I was unable to connect to the database. Initially I thought this was a wordpress issue, then a mysql.sock issue. I checked with a laravel app I had locally and the issue occured there too.
The issue was caused as when using dbengin to manage my databases, the default user created for each database has a blank password. This wasn’t accepted for both laravel & wordpress.
The solution was to set one using the following:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
This solved the issue of establishing connection to the wordpress site (and a laravel app I used to test the connection).