php artisan migration

编程入门 行业动态 更新时间:2024-10-26 18:17:01
本文介绍了php artisan migration-SQLSTATE [HY000] [1045]用户'laravel'@'localhost'的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想按照本课程设置并学习Laravel

I want to set up and learn Laravel following this course

当我尝试使用命令 php artisan migration 时,出现此错误:

When I try to use the command php artisan migrate I get this error:

[Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' (using password: NO) (SQL: select * from information_schema.tables whe re table_schema = laravel and table_name = migrations) [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' (using password: NO)

我一直在寻找答案.我认为可能必须在 .env 文件中进行一些更改,但我不知道是什么,到目前为止我没有尝试过.

I have looked for answers. I figured I may have to make some changes in the .env file, but I don't know what, and nothing I have tried so far has worked.

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=laravel DB_PASSWORD=

我使用的是Ubuntu 16.04,而不是视频中的Mac OS X,所以我想知道该怎么做?有一些我没有正确设置的MySQL设置吗?

I'm using Ubuntu 16.04, not a Mac OS X as in the video, so I wonder what should I do differently? Is there some MySQL setting I did not set correctly?

推荐答案

您没有名为"laravel"的用户.您应该将DB_USERNAME更改为实际用于访问数据库的数据库.通常,默认情况下它是根目录,因此.env中的更改应为

You don't have a user named 'laravel'. You should change the DB_USERNAME to the one you're actually using to access your DB. Mostly it's root by default so the changes in .env should be

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD=

更多推荐

php artisan migration

本文发布于:2023-10-26 01:20:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1528660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:php   artisan   migration

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!