Thanks everyone for your support, I have rectified the problem.
Due to the nature of of my “/etc/hosts” file, the localhost was not working in the wp-config.php.
In the wp-config.php I replaced localhost with “define(‘DB_HOST’, ‘127.0.0.1’);” and now have a database connection.
Once again thanks to all that helped with this.
Just to add to this, I can also connect to MySQL from the CLI (Command Line Interface) using Terminal.