按照 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.
发布评论
评论(1)
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