[2002] PDOException in Connection.php line 295

本文记录了一次解决MySQL数据库连接异常的经历,从发现问题到排查过程,最终确定为数据库连接自行停止导致的问题,并通过重启PHPStudy成功解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

出现这个错误,一脸懵逼。网上查阅好久。

有的是配置文件报没写完,有的是配置文件配置项填错的。

嗯嗯,但是我都不是,纠结了半天,想到是不是我数据库密码搞错了。我打开数据库连接工具,想去改个密码,才发现数据库连接工具,连接不上数据库。。。

打开phpstudy,恍然大悟,apache启动了,mysql的连接却自己停止了。

我晕,搞了半个小时。

重启phpstudy,问题解决!

至于mysql连接为啥自己自动停止,根本不晓得原因。

ok,快12点了,被这个问题,给气到了,浪费了我好多时间。必须记录下来,让它名留史册!

总结,出现这个错误,可以肯定是:90%是因为自己粗心造成的。仔细检查一哈,就可以解决了。

[10501] PDOException in Connection.php line 687 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c.mobile' in 'field list' $this->debug(false, '', $master); // 返回结果集 return $this->getResult($pdo, $procedure); } catch (\PDOException $e) { if ($this->isBreak($e)) { return $this->close()->query($sql, $bind, $master, $pdo); } throw new PDOException($e, $this->config, $this->getLastsql()); } catch (\Throwable $e) { if ($this->isBreak($e)) { return $this->close()->query($sql, $bind, $master, $pdo); } throw $e; } catch (\Exception $e) { if ($this->isBreak($e)) { return $this->close()->query($sql, $bind, $master, $pdo); Call Stack in Connection.php line 687 at Connection->query('SELECT `c`.`id`,`c`....', [], false, false) in Connection.php line 923 at Connection->select(object(Query)) in Query.php line 3007 at Query->select() in Index.php line 36 at Index->index() at ReflectionMethod->invokeArgs(object(Index), []) in Container.php line 395 at Container->invokeReflectMethod(object(Index), object(ReflectionMethod), []) in Module.php line 132 at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null) at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185 at Middleware->think\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Middleware.php line 130 at Middleware->dispatch(object(Request), 'controller') in Module.php line 137 at Module->exec() in Dispatch.php line 168 at Dispatch->run() in App.php line 432 at App->think\{closure}(object(Request), object(Closure), null) at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185 at Middleware->think\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Middleware.php line 130 at Middleware->dispatch(object(Request)) in App.php line 435 at App->run() in index.php line 21
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值