Question

How do I enable this type of command on a mysql server and what is it?

I see it client code:

//$dsn = "mysql://root@localhost/username";
//$dsn = "mysql://admin@999.69.205.174/pass";

Normally I would expect:

$con=mysql_connect($db,$dbuSER,$dbpass);
Was it helpful?

Solution

In PHP using the PEAR::DB package to open a connection without an external DSN (a "DSN-less connection", i.e., using a Connection String), the code might resemble the following:

require_once("DB.php");
//$dsn = "<driver>://<username>:<password>@<host>:<port>/<database>";
$dsn = "mysql://john:pass@localhost:port/my_db";
$db = DB::connect($dsn);

http://en.wikipedia.org/wiki/Data_Source_Name

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top