首页 > 解决方案 > 打开一页时,XAMPP MySQL 已开始意外关闭

问题描述

你好!:D

我正在制作一个网站以获得乐趣,在离开工作几个小时后,当我回来时,每次打开网站的一个页面时都会遇到意外的关闭错误。

使用数据库的其他页面工作正常,我遇到问题的确切页面也可以正常工作,因为它应该上次我正在处理它......我尝试在没有的情况下更改 PHP 文件中的最新更改任何结果。

我已经尝试了所有听起来不像可能会破坏我在大约 2-3 小时后试图解决这个问题后找到的数据库的方法,复制备份文件夹和数据文件夹以创建一个新的数据文件夹,但错误仍然存​​在。我找不到使用相同端口的任何其他程序,这甚至不应该是问题,因为它适用于网站的所有其他页面......

错误:

XAMPP 控制面板:

22:09:48  [mysql]   Error: MySQL shutdown unexpectedly.
22:09:48  [mysql]   This may be due to a blocked port, missing dependencies, 
22:09:48  [mysql]   improper privileges, a crash, or a shutdown by another method.
22:09:48  [mysql]   Press the Logs button to view error logs and check
22:09:48  [mysql]   the Windows Event Viewer for more clues
22:09:48  [mysql]   If you need more help, copy and post this
22:09:48  [mysql]   entire log window on the forums

MySQL 日志:

InnoDB: using atomic writes.
2021-07-11 22:25:31 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-07-11 22:25:31 0 [Note] InnoDB: Uses event mutexes
2021-07-11 22:25:31 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-07-11 22:25:31 0 [Note] InnoDB: Number of pools: 1
2021-07-11 22:25:31 0 [Note] InnoDB: Using SSE2 crc32 instructions
2021-07-11 22:25:31 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2021-07-11 22:25:31 0 [Note] InnoDB: Completed initialization of buffer pool
2021-07-11 22:25:31 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1238359
2021-07-11 22:25:31 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-07-11 22:25:31 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-07-11 22:25:31 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-07-11 22:25:31 0 [Note] InnoDB: Setting file 'D:\XAMMP\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-07-11 22:25:31 0 [Note] InnoDB: File 'D:\XAMMP\mysql\data\ibtmp1' size is now 12 MB.
2021-07-11 22:25:31 0 [Note] InnoDB: Waiting for purge to start
2021-07-11 22:25:31 0 [Note] InnoDB: 10.4.13 started; log sequence number 1238368; transaction id 2064
2021-07-11 22:25:31 0 [Note] InnoDB: Loading buffer pool(s) from D:\XAMMP\mysql\data\ib_buffer_pool
2021-07-11 22:25:31 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-07-11 22:25:31 0 [Note] Server socket created on IP: '::'.

网站错误/警告:

Warning: mysqli_stmt_execute(): MySQL server has gone away in D:\XAMMP\htdocs\XXX(Censored)XXX\includes\functionsStatInter.inc.php on line 60

Warning: mysqli_stmt_execute(): Error reading result set's header in D:\XAMMP\htdocs\XXX(Censored)XXX\includes\functionsStatInter.inc.php on line 60

Fatal error: Uncaught TypeError: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\XAMMP\htdocs\XXX(Censored)XXX\includes\functionsStatInter.inc.php:68 Stack trace: #0 D:\XAMMP\htdocs\XXX(Censored)XXX\includes\functionsStatInter.inc.php(68): mysqli_num_rows(false) #1 D:\XAMMP\htdocs\XXX(Censored)XXX\statistics_interactive.php(60): AmountRuns2() #2 {main} thrown in D:\XAMMP\htdocs\XXX(Censored)XXX\includes\functionsStatInter.inc.php on line 68

需要更多信息吗?如果你觉得我错过了什么,请告诉我!

=====

2021 年 12 月 7 日更新

当我打算尝试评论中的建议时,我发现现在我根本无法加载与数据库有关的任何事情......错误中建议的任何事情都没有改变。

来自 PhPMyAdmin 的错误:

MySQL said: Documentation

Cannot connect: invalid settings.
 mysqli::real_connect(): MySQL server has gone away
 mysqli::real_connect(): Error while reading greeting packet. PID=19092
 mysqli::real_connect(): (HY000/2006): MySQL server has gone away
 Connection for controluser as defined in your configuration failed.
 mysqli::real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
 phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

=====

2021 年 12 月 7 日更新(几小时后)

我在上次更新中遇到的问题似乎是我尝试了一些建议来解决我在其他地方发现的问题,但我可能搞砸了。所以我把所有的东西都改回原来的样子,现在将开始研究如何解决我从一开始就问到的主要问题。:D

=====

2021 年 13 月 7 日更新

哈哈,哇...问题似乎是我一直很愚蠢...:P

所以问题是我使用“?” 要替换 SQL 代码中的某些值,这是由会话设置的,会话本身由表单设置。因此,当会话被重置时,我还没有添加一个默认值,如果它们没有设置则使用......所以这就是导致问题的原因。

无论如何,非常感谢所有的帮助!:D <3

标签: phpmysqlxampp

解决方案


由于没有发布任何真正的答案,即使我在评论中进行了有益的对话,我认为我可能应该自己发布答案,因为在尝试了一些帮助我的评论技巧后,我设法解决了所有问题解决这个问题。

解决方案:

所以问题是我使用“?” 要替换 SQL 代码中的某些值,这是由会话设置的,会话本身由表单设置。因此,当会话在一段时间后自动重置时,我还没有添加一个默认值,如果它们没有设置则使用......所以这就是导致问题的原因。

为什么?

这就解释了为什么它在一天后尝试访问该页面时开始崩溃,而我没有更改任何内容。

感谢所有的帮助,它指导我一个一个地测试每个 SQL 段,并且它们都按预期工作。这让我想到它是别的东西,所以我删除了所有连接到数据库的东西,每个人都让它自己崩溃了。然后我来想可能是会话不起作用,所以我删除了与数据库有关的所有内容,填写表格然后保存,以便进行会话。然后,当我将所有连接添加回数据库时,一切正常。

再次感谢您的帮助!:D


推荐阅读