数据库
首页 > 数据库> > PHP MySQL DSN连接-如何启用mysql://

PHP MySQL DSN连接-如何启用mysql://

作者:互联网

如何在mysql服务器上启用此类型的命令,它是什么?

我看到了客户端代码:

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

通常我会期望:

$con=mysql_connect($db,$dbuSER,$dbpass);

解决方法:

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

标签:dsn,mysql-proxy,mysql
来源: https://codeday.me/bug/20191101/1985701.html