I recently came across the following situation. A new server, a client-defined database, a database name like this: ‘my-database’. Checking if the DB exists in PhpMyAdmin, everything checks out. Putting all the details in wp-config.php should also work, right?
define('DB_NAME', 'my-database');Hmmm. No, not quite. Error establishing a database connection Could it really be, that the dash in ‘my-database’ messes up the DB_NAME? Apparently yes.
define('DB_NAME', "my-database");Ok, problem solved. As for why, that’s still an open question.