XAMPP MySQL have started to shuts down unexpectedly when opening one page

Hello! 😀

I’m making a website for the fun of it and after leaving the work for a few hours, when I returned back I get an unexpected shutdown error every time that I open one of the pages of the website.

Other pages where the database is used are working fine, the exact page I’m having a problem with also worked as it should last time I was working on it… I have tried changing back the most recent changes in the PHP files without any result.

I have tried everything that doesn’t sound like it may ruin the database that I could find after about 2-3h trying to solve this, copying the backup folder and the data folder to make a new data folder and the error is still there.
I can’t find any other program using the same port, which shouldn’t even be the problem since it works for all other pages of the website…

Errors:

XAMPP Control Panel:

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 Logs:

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:XAMMPmysqldataibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-07-11 22:25:31 0 [Note] InnoDB: File 'D:XAMMPmysqldataibtmp1' 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:XAMMPmysqldataib_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: '::'.

Website Errors/Warnings:

Warning: mysqli_stmt_execute(): MySQL server has gone away in D:XAMMPhtdocsXXX(Censored)XXXincludesfunctionsStatInter.inc.php on line 60

Warning: mysqli_stmt_execute(): Error reading result set's header in D:XAMMPhtdocsXXX(Censored)XXXincludesfunctionsStatInter.inc.php on line 60

Fatal error: Uncaught TypeError: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:XAMMPhtdocsXXX(Censored)XXXincludesfunctionsStatInter.inc.php:68 Stack trace: #0 D:XAMMPhtdocsXXX(Censored)XXXincludesfunctionsStatInter.inc.php(68): mysqli_num_rows(false) #1 D:XAMMPhtdocsXXX(Censored)XXXstatistics_interactive.php(60): AmountRuns2() #2 {main} thrown in D:XAMMPhtdocsXXX(Censored)XXXincludesfunctionsStatInter.inc.php on line 68

Any more information needed? Please tell me if you feel I missed something!

=====

UPDATE 12/7-2021

When I was going to try the suggestions from the comments, I found out that now I can’t load anything that has to do whit the database at all…
Nothing of the things suggested in the error has ever been changed.

Error from 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.

=====

UPDATE 12/7-2021 (a few hours later)

The problem I got in the last update seems to be that I tried things that were suggested to solve the problem that I have found in other places and I probably messed something up.
So I changed back everything to as it was before, will start working on how to solve the main problem that I asked about from the beginning now. 😀

=====

UPDATE 13/7-2021

Haha, wow… it seems like the problem was me being stupid all the time… 😛

So the problem was that I use “?” to replace some values in the SQL code, this is set by sessions that themselves are set by a form.
So when the sessions were reset, I had not yet added a default that is used if they aren’t set… so this was what caused the problem all along.

Thanks so much for all help anyway! 😀 <3

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Since there was not any real answer posted, even though I had a helpful conversation in the comments I thought that I maybe should post an answer myself since I managed to solve everything after trying out a few tips from the comments that helped me on the way to solve this.

Solution:

So the problem was that I use “?” to replace some values in the SQL code, this is set by sessions that themselves are set by a form. So when the sessions were automatically reset after some time, I had not yet added a default that is used if they aren’t set… so this was what caused the problem all along.

Why?

That explains why it worked as it supposed to do one day to start crashing when trying to access the page a day later without me changing anything.

Thanks for all the help, it guided me to test every SQL segment one by one and all of them worked as supposed to.
This got me thinking about it was something else, so I removed all but one thing connected to the database and everyone made it crash just by themselves.
Then I came and think about that it maybe was that the sessions were not working, so I removed everything that had to do with the database, filled in the form and then saved it so that the sessions were made.
When I then added all connections to the database back, everything worked just as it should.

Once again, thanks for the help! 😀


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x