Laravel 4迁移:安装ErrorException [英] Laravel 4 migration:install ErrorException

查看:78
本文介绍了Laravel 4迁移:安装ErrorException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

php artisan migrate:install

{"error":{"type":"ErrorException","message":"PDO::__construct(): [2002] Connection refused (trying to connect via tcp:\/\/127.0.0.1:3306)","file":"\/Applications\/MAMP\/htdocs\/DRCSports\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Connectors\/Connector.php","line":47}}

在我的database.php中,我已将信息更新为mysql

In my database.php I have updated the information to mysql

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

我不确定我是否理解错误,但是对我来说,我的Laravel似乎没有正确连接到mysql.如果是这种情况,我不知道如何解决.

I am not sure if I am understanding the error right, but to me it looks like my laravel isn't connecting to mysql right. If that is the case I have no clue how to fix it.

推荐答案

问题是mysql在端口8888上运行,而Laravel的默认端口值为3306(因为它是mysql服务器的默认端口).

The problem was that mysql is running on port 8888, while Laravel's default port value is 3306 (as it's the default port of mysql servers).

解决方案是将'port'键添加到数组(例如:'port'=> 8888),它将 做工作.

The solution is to add 'port' key to the array (For example: 'port' => 8888) and it'll do the work.

这篇关于Laravel 4迁移:安装ErrorException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆