Laravel向我显示"用户'homestead'@'localhost(使用密码:是)"的访问被拒绝".一个解决方案是清除缓存和存储的配置缓存,所有这些都使用以下三个命令:

php artisan cache:clear
php artisan config:clear
php artisan config:cache

php artisan cache:clear后,终端显示:

Failed to clear cache. Make sure you have the appropriate permissions. (with red background)

Doing the second and third code (php artisan config:clear and php artisan config:cache) works fine! But it still gives me the error when typing the first line. Can anyone explain why?

推荐答案

If the data directory doesn't exist under (storage/framework/cache/data), then you will have this error.

This data directory doesn't exist by default on a fresh/new installation.

在(storage/framework/cache)处手动创建data目录应该可以解决此问题.

Laravel相关问答推荐

如何在 Laravel 中使用多对一变形关系

按回车键时如何防止此功能运行?

通过 laravel 中的 url 传递多个字符串作为参数以从数据库中删除特定数据

我的共享主机上的每个帖子请求都出现 503 服务不可用

Laravel 错误ReflectionException-类 App\Http\Kernel 不存在

Laravel API 版本控制文件夹 struct

Blade引擎:打印三重花括号

使用 Laravel 限制多态多对多关系中的相关记录

laravel 5 中的登录事件处理

Homestead:文件夹映射到错误的文档根目录

如何在 AWS Elastic Beanstalk 上设置和使用 Laravel 调度?

php Laravel-遇到格式不正确的数值(在字符串上)

laravel 4 - 如何限制(采取和跳过)Eloquent的 ORM?

Eloquent - 更新集合中的所有模型

验证匹配字符串

判断输入是否来自控制台

Laravel 中的单会话登录

Laravel Eloquent模型如何从关系表中获取数据

Laravel homestead IP地址不起作用

使用 Nginx 设置 Laravel