SQLSTATE [HY000] [1045]用户'homestead'@'localhost'的访问被拒绝(使用密码:是)(SQL:从“表"中选择*) [英] SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from `table`)

查看:528
本文介绍了SQLSTATE [HY000] [1045]用户'homestead'@'localhost'的访问被拒绝(使用密码:是)(SQL:从“表"中选择*)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel,并且已经配置了.env文件.当我进行迁移并进行迁移时,它会影响数据库,但是当我尝试从同一数据库读取数据时,会出现此异常.谢谢

I am using Laravel, and I have already configured .env file. When I make migration and I migrate, it affects the database, but when I try to read from same database I get this exception. Thank you

SQLSTATE [HY000] [1045]用户'homestead'@'localhost'的访问被拒绝 (使用密码:是)(SQL:从table中选择*)

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from table)

推荐答案

您必须设置正确的权限:

You have to set the right permissions:

$ mysql -u root -p
$ <your-password>
$ use mysql
$ GRANT ALL ON *.* to 'homestead'@'localhost' IDENTIFIED BY '<your-password>';
$ FLUSH PRIVILEGES;

这篇关于SQLSTATE [HY000] [1045]用户'homestead'@'localhost'的访问被拒绝(使用密码:是)(SQL:从“表"中选择*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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