french_dev french_dev - 7 months ago 78
MySQL Question

SQLSTATE[HY000] [2005] Unknown MySQL server host '' (2)

I have this error when i try to access to some web pages of my project:

SQLSTATE[HY000] [2005] Unknown MySQL server host '' (2)

alwaysdata is the phpmyadmin website I use for my database.

I noticed that it's when I try to access in some pages in relation with the database (create user for example... etc) and there's no problems with other pages like 'contact'.

I'm on mac OSX and I use MAMP server, always data, laravel and netbeans IDE. all configurations required to make the connection between my project and the database is correct.

Here it is:

SQLSTATE[HY000] [2005] Unknown MySQL server host '' (2)


public function createConnection($dsn, array $config, array $options)
$username = array_get($config, 'username');

$password = array_get($config, 'password');

return new PDO($dsn, $username, $password, $options);

If someone have an idea...

Thank you.


The port has it's own parameter in the DSN:


Alternatively just omit the port, 3306 is the default port.