如何使用 Doctrine 1.2 连接到 MySQL 套接字?

发布于 2024-11-14 14:04:07 字数 644 浏览 5 评论 0 原文

按照 http://www.doctrine-project.org/projects/orm/1.2/docs/manual/introduction-to-connections/en#dsn,-the-data-source-name:examples,我收到以下错误

Message: PDO Connection Error: SQLSTATE[HY000] [2005] Unknown MySQL server host 'unix(' (1) 

我使用的确切 DSN 是“mysql://root@unix(/tmp/mysql.sock)/test” 是的,root 通过本地 unix 套接字,无需密码。

这个确切的配置适用于 phpMyAdmin,所以我知道这些设置是有效的。我还尝试使用另一个用户的密码并得到相同的错误。

让我困惑的是,当我尝试按照提供的说明通过套接字连接时,为什么它会抛出有关主机的错误。

Following the directions at http://www.doctrine-project.org/projects/orm/1.2/docs/manual/introduction-to-connections/en#dsn,-the-data-source-name:examples, I get the following error

Message: PDO Connection Error: SQLSTATE[HY000] [2005] Unknown MySQL server host 'unix(' (1) 

The exact DSN I am using is "mysql://root@unix(/tmp/mysql.sock)/test"
Yes, root with no password via local unix socket.

This exact configuration works with phpMyAdmin, so I know the settings are valid. I've also tried with another user with password and got the same error.

What confuses me is why it's throwing the error about the host, when I'm trying connect via socket as the instructions provided.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巴黎夜雨 2024-11-21 14:04:07

Doctrine 需要类似 PDO 的查询字符串,看看它是否与您的匹配:

http:// www.php.net/manual/en/pdo.construct.php

此外,看看这个:

Doctrine(在 symfony 项目中)无法通过套接字连接

Doctrine needs PDO-like query string, see if it matches yours:

http://www.php.net/manual/en/pdo.construct.php

Moreover, have a look at this:

Doctrine (in symfony project) can not connect through socket

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文