PHP symfony doctrine:insert-sql
我得到的错误:
Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://127.0.0.1:3306) in /Users/johannes/Programmering/PHP/htdocs/symfony/sfprojects/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.PHP on line 470
databases.yml里
all: doctrine: class: sfDoctrineDatabase param: dsn: MysqL:host=127.0.0.1;dbname=jobeet; username: root password: root
使用“root”作为密码进行MysqL -u root -p jobeet可以访问,所以没有问题.是的,我运行的MysqL是MAMP的.
感谢任何帮助.
将dsn更改为@Tom建议您解决问题.奇怪的是,但使用localhost而不是127.0.0.1使MysqL通过套接字连接.
http://dev.mysql.com/doc/refman/5.0/en/connecting.html:
On Unix,MysqL programs treat the host name localhost specially,in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost,MysqL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a –port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server,use –host or -h to specify a host name value of 127.0.0.1,or the IP address or name of the local server. You can also specify the connection protocol explicitly,even for localhost,by using the –protocol=TCP option.
原文地址:https://www.jb51.cc/php/138201.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。