Laravel:SQLSTATE [HY000] [2002]连接被拒绝 [英] Laravel: SQLSTATE[HY000] [2002] Connection refused

查看:425
本文介绍了Laravel:SQLSTATE [HY000] [2002]连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用装有新的laravel 5.4的Vagrant.在运行auth之后,我已经进行了迁移以迁移MySQL表.所有这些过程都成功了,但是当我尝试登录或注册以测试系统时,我得到了错误:

I am using Vagrant with fresh laravel 5.4 installed. After I run auth I have ran the migrate to migrate the MySQL tables. All of these process successful but when I try to login or register to test the system I am getting error:

SQLSTATE [HY000] [2002]连接被拒绝.

SQLSTATE[HY000] [2002] Connection refused.

但是我的数据库运行良好,因为我已经能够迁移表.有什么可能的解决方案?检查附件图像(我使用的是Ubuntu 16.04)

But my database working perfect since I already able to migrate the tables. Whats possible solution could be? check attached image (I'm using Ubuntu 16.04)

推荐答案

尝试将DB_HOST从127.0.0.1更改为localhost.如果仍然无法正常工作,请尝试使用默认的mysql端口3306

Try changing your DB_HOST from 127.0.0.1 to localhost. and if still not working try using the default mysql port to 3306

这篇关于Laravel:SQLSTATE [HY000] [2002]连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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