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

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

      <tfoot id='Pr3LC'></tfoot>
        <bdo id='Pr3LC'></bdo><ul id='Pr3LC'></ul>

    1. SQLSTATE[HY000] [2003] Can't connect to MySQL server on

      SQLSTATE[HY000] [2003] Can#39;t connect to MySQL server on #39;127.0.0.1#39; (61) error Laravel 4.1(SQLSTATE[HY000] [2003] Cant connect to MySQL server on 127.0.0.1 (61) error Laravel 4.1)

            <tfoot id='5rRoP'></tfoot>

            <small id='5rRoP'></small><noframes id='5rRoP'>

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

              <i id='5rRoP'><tr id='5rRoP'><dt id='5rRoP'><q id='5rRoP'><span id='5rRoP'><b id='5rRoP'><form id='5rRoP'><ins id='5rRoP'></ins><ul id='5rRoP'></ul><sub id='5rRoP'></sub></form><legend id='5rRoP'></legend><bdo id='5rRoP'><pre id='5rRoP'><center id='5rRoP'></center></pre></bdo></b><th id='5rRoP'></th></span></q></dt></tr></i><div id='5rRoP'><tfoot id='5rRoP'></tfoot><dl id='5rRoP'><fieldset id='5rRoP'></fieldset></dl></div>
                <bdo id='5rRoP'></bdo><ul id='5rRoP'></ul>
                  <tbody id='5rRoP'></tbody>
                本文介绍了SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (61) error Laravel 4.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 Laravel 4.1(使用 MAMP)的本地主机上收到以下错误

                I am receiving the following error on my localhost for Laravel 4.1 (using MAMP)

                SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (61)
                

                它指向:

                /Applications/MAMP/htdocs/crowdsets/laravel-master/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php
                

                这是它指向的函数:

                public function createConnection($dsn, array $config, array $options)
                    {
                        $username = array_get($config, 'username');
                
                        $password = array_get($config, 'password');
                
                        return new PDO($dsn, $username, $password, $options);
                    }
                

                到目前为止,我还没有收到此错误.

                Up to this point, I had not received this error.

                我设置了本地环境和生产环境(默认).

                I have a local environment and production environment set up (the default).

                在 config/local/database.php 我有:

                in config/local/database.php I have:

                'mysql' => array(
                            'driver'    => 'mysql',
                            'host'      => '127.0.0.1',
                            'database'  => 'database',
                            'username'  => 'root',
                            'password'  => 'root',
                            'charset'   => 'utf8',
                            'collation' => 'utf8_unicode_ci',
                            'prefix'    => '',
                        ),
                

                推荐答案

                这样的错误意味着服务器本身甚至无法访问.您是否在 MAMP 中启动了 MySQL?

                An error like that means the server itself is not even reachable. Did you start MySQL in MAMP?

                另外,您是如何开始 MAMP 的?使用标准 MySQL 3306 端口?或者 MAMP 用于非管理员的替代端口:8889?

                Also, how have you started MAMP? With the standard MySQL 3306 port? Or the alternative port MAMP uses for non-admins: 8889?

                我打赌您的服务器正在运行,但正在尝试连接到 3306,因此您需要将端口设置为 8889.将您的配置更改为这样;注意添加 port 参数:

                I bet your server is running, but is attempting to connect to 3306 so you need to set the port to 8889. Change your config to be like this; note the addition of the port param:

                'mysql' => array(
                            'driver'    => 'mysql',
                            'host'      => '127.0.0.1',
                            'port'      => '8889',
                            'database'  => 'database',
                            'username'  => 'root',
                            'password'  => 'root',
                            'charset'   => 'utf8',
                            'collation' => 'utf8_unicode_ci',
                            'prefix'    => '',
                        ),
                

                我刚刚发现 this question thread 解决了通过端口 8889 将 Laravel 连接到 MAMP 的问题.

                I just found this question thread that addresses the issue of connecting Laravel to MAMP via port 8889.

                这篇关于SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (61) error Laravel 4.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Laravel 4 - Connect to other database(Laravel 4 - 连接到其他数据库)
                Call external API function from controller, LARAVEL 4(从控制器调用外部 API 函数,LARAVEL 4)
                Empty string instead of null values Eloquent(空字符串而不是空值 Eloquent)
                quot;laravel.logquot; could not be opened: failed to open stream(“laravel.log无法打开:无法打开流)
                Displaying the Error Messages in Laravel after being Redirected from controller(从控制器重定向后在 Laravel 中显示错误消息)
                Laravel Creating Dynamic Routes to controllers from Mysql database(Laravel 从 Mysql 数据库创建到控制器的动态路由)

                    <bdo id='3WuHI'></bdo><ul id='3WuHI'></ul>

                        <legend id='3WuHI'><style id='3WuHI'><dir id='3WuHI'><q id='3WuHI'></q></dir></style></legend>

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

                          <small id='3WuHI'></small><noframes id='3WuHI'>