<tfoot id='mp4ke'></tfoot>

<small id='mp4ke'></small><noframes id='mp4ke'>

    • <bdo id='mp4ke'></bdo><ul id='mp4ke'></ul>

      1. <legend id='mp4ke'><style id='mp4ke'><dir id='mp4ke'><q id='mp4ke'></q></dir></style></legend>

      2. <i id='mp4ke'><tr id='mp4ke'><dt id='mp4ke'><q id='mp4ke'><span id='mp4ke'><b id='mp4ke'><form id='mp4ke'><ins id='mp4ke'></ins><ul id='mp4ke'></ul><sub id='mp4ke'></sub></form><legend id='mp4ke'></legend><bdo id='mp4ke'><pre id='mp4ke'><center id='mp4ke'></center></pre></bdo></b><th id='mp4ke'></th></span></q></dt></tr></i><div id='mp4ke'><tfoot id='mp4ke'></tfoot><dl id='mp4ke'><fieldset id='mp4ke'></fieldset></dl></div>

        使用 symfony 和 MAMP 时出现 PDO 连接错误

        PDO connection error when using symfony and MAMP(使用 symfony 和 MAMP 时出现 PDO 连接错误)
          <bdo id='TcaF5'></bdo><ul id='TcaF5'></ul>

          1. <tfoot id='TcaF5'></tfoot>
          2. <small id='TcaF5'></small><noframes id='TcaF5'>

              • <i id='TcaF5'><tr id='TcaF5'><dt id='TcaF5'><q id='TcaF5'><span id='TcaF5'><b id='TcaF5'><form id='TcaF5'><ins id='TcaF5'></ins><ul id='TcaF5'></ul><sub id='TcaF5'></sub></form><legend id='TcaF5'></legend><bdo id='TcaF5'><pre id='TcaF5'><center id='TcaF5'></center></pre></bdo></b><th id='TcaF5'></th></span></q></dt></tr></i><div id='TcaF5'><tfoot id='TcaF5'></tfoot><dl id='TcaF5'><fieldset id='TcaF5'></fieldset></dl></div>

                  <legend id='TcaF5'><style id='TcaF5'><dir id='TcaF5'><q id='TcaF5'></q></dir></style></legend>
                    <tbody id='TcaF5'></tbody>
                • 本文介绍了使用 symfony 和 MAMP 时出现 PDO 连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  尝试执行时收到 PDO 错误 php symfony 学说:插入-sql
                  我得到的错误:

                  <上一页>警告:PDO::__construct(): [2002] 连接被拒绝(试图通过 tcp://127.0.0.1:3306 连接)在/Users/johannes/Programmering/PHP/htdocs/symfony/sfprojects/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php 在第 470 行

                  databases.yml

                  <上一页>全部:教义:类:sfDoctrineDatabase参数:dsn: mysql:host=127.0.0.1;dbname=jobeet;用户名:root密码:root

                  使用root"作为密码执行 mysql -u root -p jobeet 可以让我访问,所以没有问题.是的,我运行的 mysql 是 MAMP 的.

                  感谢您的帮助.

                  解决方案

                  MAMP 默认不允许 TCP 连接.您可以打开它或使用插座.

                  按照@Tom 的建议更改您的 dsn 应该可以解决您的问题.虽然很奇怪,但使用 localhost 而不是 127.0.0.1 使得 mysql 通过套接字连接.

                  http://dev.mysql.com/doc/refman/5.0/en/connecting.html :

                  <块引用>

                  在 Unix 上,MySQL 程序处理主机以某种方式特别命名 localhost这可能与您的不同与其他基于网络的期望相比程式.对于连接到localhost,MySQL 程序试图通过使用连接到本地服务器Unix 套接字文件.即使发生这种情况一个 --port 或 -P 选项被赋予指定端口号.以确保客户端建立 TCP/IP 连接到本地服务器,使用 --host 或 -h指定主机名值127.0.0.1,或本地服务器的 IP 地址或名称.你也可以指定连接协议明确地,即使对于本地主机,通过使用 --protocol=TCP 选项.

                  Getting an PDO error when trying to do php symfony doctrine:insert-sql
                  The error I get:

                  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
                  

                  Doing a mysql -u root -p jobeet with "root" as password gives me access, so no problem there. And yes, the mysql that I run is MAMP's.

                  Thanks for any help.

                  解决方案

                  MAMP by default doesn't allow TCP connections. You can either turn it on or use sockets.

                  Changing your dsn as @Tom suggests should fix your issues. Weird as it is but using localhost instead of 127.0.0.1 makes that mysql connects through sockets.

                  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.

                  这篇关于使用 symfony 和 MAMP 时出现 PDO 连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                • <small id='7Owlo'></small><noframes id='7Owlo'>

                    <legend id='7Owlo'><style id='7Owlo'><dir id='7Owlo'><q id='7Owlo'></q></dir></style></legend>

                    • <bdo id='7Owlo'></bdo><ul id='7Owlo'></ul>

                      <i id='7Owlo'><tr id='7Owlo'><dt id='7Owlo'><q id='7Owlo'><span id='7Owlo'><b id='7Owlo'><form id='7Owlo'><ins id='7Owlo'></ins><ul id='7Owlo'></ul><sub id='7Owlo'></sub></form><legend id='7Owlo'></legend><bdo id='7Owlo'><pre id='7Owlo'><center id='7Owlo'></center></pre></bdo></b><th id='7Owlo'></th></span></q></dt></tr></i><div id='7Owlo'><tfoot id='7Owlo'></tfoot><dl id='7Owlo'><fieldset id='7Owlo'></fieldset></dl></div>
                            <tbody id='7Owlo'></tbody>
                          <tfoot id='7Owlo'></tfoot>