Access denied for user #39;root#39;@#39;localhost#39; - Laravel(用户root@localhost的访问被拒绝 - Laravel)
问题描述
我有一个使用 Laravel 4 的应用程序,它可以在 localhost 中正确运行,但是当我将它上传到我的主机时,我收到了错误.
I have an application with Laravel 4, that runs in localhost correctly, but when I uploaded it in my host I received the error .
app>config>database.php 文件是:
app>config>database.php file is:
'mysql' => array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => 'forum',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
而 bootstrap>start.php 是:
And bootstrap>start.php is:
$env = $app->detectEnvironment(array(
'local' => array('homestead'),
));
推荐答案
这对我有用:
php artisan config:clear
即使我更改了 .env 文件中的 config 详细信息,我仍然收到拒绝访问错误.运行上述命令将清除配置缓存文件,因此 laravel 将从 .env 文件中读取新数据.
Even though I changed the config details in the .env file, I was getting the Access denied error. Running the above command will clear configuration cache file and hence laravel will read the fresh data from the .env file.
这篇关于用户'root'@'localhost'的访问被拒绝 - Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用户'root'@'localhost'的访问被拒绝 - Laravel
基础教程推荐
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
