[1045] PDOException in Connection.php line 295
tp5实现登录功能时报错
在使用tp5框架实现登录功能的时候,点击login出现了 [1045] PDOException in Connection.php line 295 这个问题,
报错是 SQLSTATE[HY000] [1045] Access denied for user 'root' @ 'localhost' (using password: NO)
百度了好多没有合适的方法,只好厚着脸皮去问学长(毕竟在他培训的时候我没去),结果这个错误还真的挺低级的,,但毕竟,我第一次学嘛
在此附上学长写的怎样实现登录功能的文章链接~https://blog.csdn.net/qq_41028544/article/details/84726917
解决办法:数据库连接不正确,打开application文件夹下的database.php,补充/修改信息即可
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => '**a**',
// 用户名
'username' => '**b**',
// 密码
'password' => '**c**',
a为自己为此框架设置的数据库名,b为数据库用户名,c为数据库密码,127.0.0.1代表本地,mysql为数据库类型
后记:运行代码的时候忽略了连接数据库的问题,经学长提示恍然大悟,对哦~我在哪连接的数据库呢,程序怎么知道我要连接哪一个数据库呢~~~唉,低级错误要不得!
实现过程中还遇到了一个小插曲,毕竟没有去听学长讲课,建数据库表的时候没人告诉我要为password设置多长,我就设了30,只能存30位字符,而正确密码有32位。因为代码中的判断密码是用了md5加密的,加密后是32位(也可以是16位),所以我永远显示用户名或密码错误~
此博文为作者原创,转载请注明来源~https://www.cnblogs.com/zcl843264327/p/10085076.html
[1045] PDOException in Connection.php line 295的更多相关文章
- thinkPHP连接数据库报错:PDOException in Connection.php line 295
跑去网上找了N多方法来尝试,重装apache.mysql.安装集成软件都试过了.错误一样. 后来细细分析,PDOException in Connection指的不就是PDO异常吗? 然后去了解了一些 ...
- Laravel [1045] 解决方法 Access denied for user 'homestead'@'localhost'
这几天学习Laravel框架遇到了数据库方面的问题. PDOException in Connector.php line 55:SQLSTATE[HY000] [1045] Access denie ...
- Laravel [1045] Access denied for user 'homestead'@'localhost' .env没有配置
laravel 连接数据库出现错误 PDOException in Connector.php line 55:SQLSTATE[HY000] [1045] Access denied for use ...
- redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
$ pip install redis>>> import redis>>> conn = redis.Redis()>>> conn.keys( ...
- pytorch bug: for step,data in enumerate(loader)+Connection reset by peer
单GPU跑的程序,而且是在docker中,迭代了几百步后,程序突然崩掉了, 程序停在了 for step,data in enumerate(loader),下面是部分bug信息 Traceback ...
- 【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
问题描述 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connecti ...
- laravel5 数据库连接问题
[PDOException] SQLSTATE[28000] [1045] Access denied for user ‘homestead’@’localhost’ (using password ...
- 因采用 Flask 原生 WSGI 出现 "Broken pipe" 报错的故障处理
:first-child { margin-top: 0; } blockquote > :last-child { margin-bottom: 0; } img { border: 0; m ...
- Laravel 手记(连接mysql)
这几天学习Laravel框架遇到了数据库方面的问题. PDOException in Connector.php line 55:SQLSTATE[HY000] [1045] Access denie ...
随机推荐
- Win8Metro(C#)数字图像处理--2.20图像垂直镜像
原文:Win8Metro(C#)数字图像处理--2.20图像垂直镜像 [函数名称] 图像垂直镜像函数MirrorYProcess(WriteableBitmap src) [函数代码] ...
- ArcGIS中Python逆地理编码,根据坐标获取实际的地址
import json import urllib import arcpy def getAddress(lng,lat): url= 'http://restapi.amap.com/v3/geo ...
- 修复VirtualBox "This kernel requires the following features not present on the CPU: pae Unable to boot – please use a kernel appropriate for your CPU"(安装深度Linux的时候就需要)
异常处理汇总-开发工具 http://www.cnblogs.com/dunitian/p/4522988.html 修复VirtualBox "This kernel requires ...
- ChartDirector应用笔记(可同时为Web和Qt MFC提供图表)
ChartDirector介绍 ChartDirector是一款小巧精细的商业图表库.其适用的语言范围非常广泛,包括.Net, Java, Asp, VB, PHP, Python, Ruby, C+ ...
- Delphi各种从文件里读取内容的方法
Hi I am having a problem running a function to read a text file the problem seems to be that my anti ...
- C# 对字段忽略模型校验
1.在if (!ModelState.IsValid)之前给字段赋值,然后TryUpdateModel()2.使用如下方法 public ActionResult Create([Bind(Exclu ...
- [2017.02.13] linux平台下统计C++项目文件个数和代码行数
#输出排序后文件名 file='find . -name "*.[ch]" | sort' #统计文件个数 filecnt='find . -name "*.[ch]&q ...
- "犯罪心理"解读Mybatis拦截器
原文链接:"犯罪心理"解读Mybatis拦截器 Mybatis拦截器执行过程解析 文章写过之后,我觉得 "Mybatis 拦截器案件"背后一定还隐藏着某种设计动 ...
- js数字转成金额格式
本文有以下三个段落 1.方法展示 2.方法说明 3.方法实例 1.方法展示 //将数字转换成金额显示 function toMoney(num){ num = num.toFixed(2); num ...
- LCN自动补偿
LCN自动补偿 1当出现需要补偿的数据的时候,LCN将请求tm.compensate.notifyUrl配置的通知地址, 请求补偿的样例数据格式: {"groupId":" ...