Rápli András Rápli András - 1 month ago 13
MySQL Question

PDO connect to localhost (unknown mysql server host)

I can connect to MySQL using

mysql_*
functions with the same credentials.

Is there any way to connect to a local MySQL database using PDO with a user that has
USAGE
privilege only? I don't have opportunity to set the rights to
ALL
, which I've read as a solution to a similar problem here in SO.

SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost,dbname=crmdb' (74)

Answer
 // PDO
$pdo = new PDO("mysql:host=localhost;dbname=database", 'username', 'password');

NOTE SEMI-COLON ; NOT a COMMA ,