wp-cli: Error establishing a database connection: undefined constant DB_USER

It looks like the problem was the wp-config.php

Though not sure what. I copied the content of wp-config-sample.php while keeping the same db credentials and it started working. I then reverted the changes and it is still working…

Only differences were:

Initially, when replacing the file, the Salts were not set.

And hese lines…

define( 'AUTOSAVE_INTERVAL', 300 );
define( 'WP_POST_REVISIONS', 5 );
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'WP_CRON_LOCK_TIMEOUT', 120 );

If it comes back I’ll look at the 4 defines… Hope this helps somebody, I was ripping my hairs out of my head!!