[PDOException] SQLSTATE[28000] [1045] Access denied for user ‘homestead’@’localhost’ (using password: YES) looks like same error different is not showing any file line number.

The reason of Access denied for user ‘homestead’@’localhost’ laravel 5 error is caching-issue of the .env.php file cause Laravel 5 is using environment based configuration in your .env file.

Why Environment Configuration :-

It’s often helpful to have different configuration values based on the environment the application is running in. For example, you may wish to use a different cache driver locally than you do on your production server. It’s easy using environment based configuration.

Laravel utilizes the DotEnv PHP library by Vance Lucas. In fresh Laravel installation, you will see a .env.example file in the root directory of your application. If you are installing Laravel via Composer, this file will automatically be renamed to .env. else, you need to rename the file manually. For more about Environment Configuration

default .env file looks like :-

APP_ENV=local
APP_DEBUG=true
APP_KEY=your_key DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null

How to solve this error :- let’s see how we can solve this PDOException in Connector.php line 47: SQLSTATE[28000] [1045] Access denied for user ‘homestead’@’localhost’ (using password: YES) error in laravel 5.

1. Go to your application root directory and open .env file (In ubuntu may be it’s hidden so press ctrl+h to show hidden files) in your editor and change database configuration setting. then save your .env file

DB_HOST=localhost
DB_DATABASE=laravelu
DB_USERNAME=root
DB_PASSWORD=''

2. then restart your apache server/web server. and refresh your page and you have done
3. If still issue try to run below command to clear the old configuration cache file.

php artisan config:clear

Now run your user register page and enjoy new laravel 5. Now you are done with Access denied for user ‘homestead’@’localhost’ laravel 5

laravel5 数据库连接问题的更多相关文章

  1. Laravel5.0学习--01 入门

    本文以laravel5.0.22为例. 生产环境建议使用laravel5.1版本,因为该版本是长期支持版本.5.1文档更详细:http://laravel-china.org/docs/5.1. 环境 ...

  2. Laravel5.5 的 Homestead 开发环境部署

    首先明白以下几个概念 VirtualBox  -- Oracle 公司的虚拟机软件, 能运行在当前大部分流行的系统上; Vagrant 提供一种命令行接口, 允许自动化安装虚拟机, 并且因为是脚本编写 ...

  3. Laravel 数据库连接, 数据库名,配置文件修改

    数据库连接:在根目录(laravel5.1下面有个.env文件,如果没有则会有个.env.example然后将此文件修改成.env文件即可)打开文件:找到:DB_HOST=127.0.0.1  //连 ...

  4. Laravel5.2中Eloquent与DB类的区别是什么?

    要了解这些先看看关于数据库组件的那些事儿(就是 Eloquent ORM) 数据库组件大概分了三层: 数据库连接层 查询构造层 应用层 来看一下每一层有哪些东西,分别对应文档的哪一部分: 数据库连接层 ...

  5. Java数据库连接技术——JDBC

    大家好,今天我们学习了Java如何连接数据库.之前学过.net语言的数据库操作,感觉就是一通百通,大同小异. JDBC是Java数据库连接技术的简称,提供连接各种常用数据库的能力. JDBC API ...

  6. .NET跨平台之旅:数据库连接字符串写法引发的问题

    最近在一个ASP.NET Core站点中遇到一个奇怪问题.当用dotnet run命令启动站点后,开始的一段时间请求执行速度超慢,有时要超过20秒,有时甚至超过1分钟,日志中会记录这样的错误: Sys ...

  7. Entity Framework 6 Recipes 2nd Edition(12-3)译 -> 数据库连接日志

    12-3. 数据库连接日志 问题 你想为每次与数据库的连接和断开记录日志 解决方案 EF为DbContext的连接公开了一个StateChange 事件.我们需要处理这个事件, 为每次与数据库的连接和 ...

  8. 如何修复VUM在客户端启用之后报数据库连接失败的问题

    在上一篇随笔中介绍了关于重新注册VMware Update Manager(VUM)至vCenter Server中的方法,最近有朋友反应,原本切换过去好好的更新服务为什么某次使用一下就不灵了? 当时 ...

  9. JDBC_part1_Oracle数据库连接JDBC以及查询语句

    本文为博主辛苦总结,希望自己以后返回来看的时候理解更深刻,也希望可以起到帮助初学者的作用. 转载请注明 出自 : luogg的博客园 谢谢配合! JDBC part1 JDBC概述 jdbc是一种用于 ...

随机推荐

  1. 直接在script里面换样式IE6,7,8不兼容

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  2. JS-运动基础(一)

    <title>无标题文档</title> <style> #div1{width:200px;height:200px; background:red; posit ...

  3. acm课程练习2--1001

    题目描述 Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can you find its solution between 0 and ...

  4. Git学习 -- 自定义Git

    忽略特殊文件 在工作区创建.gitignore文件,编写内容 # Windows: Thumbs.db ehthumbs.db Desktop.ini # Python: 忽略Python编译产生的. ...

  5. Chapter 1 First Sight——12

    Breakfast with Charlie was a quiet event. 和查理斯吃早饭时一件安静的事情 He wished me good luck at school. I thanke ...

  6. windows下,emacs的配置文件在哪儿?

    配置文件_Emacs在你的家目录下"C:/Documents and Settings/username/Application Data". 在Window 7下,配置文件目录在 ...

  7. javascript 中 apply(或call)方法的用途----对象的继承

    一直以来,我的理解就是  js中的Function.apply(或者是Function.call)方法是来改变Function 这个函数的执行上下文(excute Context),说白了,就是改变执 ...

  8. 阿里云CentOS安装firefox闪退

    安装完vnc远程连接,接着安装firefox,点firefox木有任何提示就退 直接命令下运行,发现错误如下: /usr/lib/firefox/firefox: symbol lookup erro ...

  9. CentOS 6.2 安装vsftpd 服务器(转)

    CentOS 6.2 安装vsftpd 服务器 本人的CentOS 6.2是安装在win 2008 R2 server 的 Hyper-V 虚拟机中.centos使用光盘安装,以最小模式安装,完成后用 ...

  10. HDU 1887 Weird Numbers(负数的进制转化)

    题目要求有两种情况,第一种from情况,正常输出即可,很简单.第二种是to情况,给一个数字,输出负进制R的原码,这个有点小麻烦...解决方法如下; 首先,把这个数n按正常方式展开,形式如下: .... ...