I'm trying to set up a new WordPress site and can't get it to connect to the database.
To to try isolate the problem, I created a php file in the same directory as the WordPress app with the following code:
<?php
$mysqli = new mysqli('localhost:3306', 'root', 'somepassword', 'gazos');
if ($mysqli->connect_error)
die('Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
else
echo 'Good connection to gazos';
?>
When I execute it from the browser, it returns Good connection to gazos.
This the first part of my wp-config.php file:
<?php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'gazos');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'somepassword');
/** MySQL hostname */
define('DB_HOST', 'localhost:3306');
Calling the supplied WordPress index.php file results in the following error:
Error establishing a database connection
I get the same error when I remove the port from localhost.
Could the php version be too new for WordPress?