More Regarding MySQL Fails to Start

Problems with the Windows version of XAMPP, questions, comments, and anything related.

More Regarding MySQL Fails to Start

Postby ajax » 19. March 2023 17:03

This is follow-up to a previous post that can be found at https://community.apachefriends.org/f/viewtopic.php?f=16&t=82729.

First and simplest is that as a result of this experience and desire to use rather than troubleshoot XAMPP I reverted to running (trying) it on a Windows 7 computer. So far after a fair amount of usage this problem has NOT occurred on Windows 7. To be fair I have NOT done much switching between different version of XAMPP and would NOT bet a lot of money that the problem will NOT occur on Windows 7 with these more current versions of XAMPP.

The referenced topic suggests that running MySQL as a Windows Service is an effective way to prevent this problem from occurring. I have now looked further into that idea and have learned that it appears as though Windows 10 does NOT intend to allow users to run such programs as a service. In fact, from what I've seen so far it is necessary to install other third party software in order to facilitate such. What have I failed to figure out?

I've also now looked closer at the batch files (mysql_start.bat & mysql_stop.bat) supplied with XAMPP that, I think are for starting and stopping XAMPP.

With respect to "mysql_start.bat" the operative command seems to be as follows:

mysql\bin\mysqld --defaults-file=mysql\bin\my.ini --standalone


This caused me to take a look at the contents of "my.ini" which turned out to be quite brief as follows:

[mysqld]
datadir=c:/xampp/mysql/data
[client]


This is surprising insofar as with my setup there is NO SUCH THING as a directory with location of "c:/xampp/mysql/data". It would be pretty simple to correct this obvious defect however it does NOT appear to be relevant. My Windows 7 Systems that are, for now, working fine contain this same defect.

With respect to "mysql_stop.bat" there exists a line as follows:

cmd.exe /C start "" /MIN call "@@BITROCK_INSTALLDIR@@\killprocess.bat" "mysqld.exe"


A file named "killprocess.bat" is NOWHERE TO BE FOUND anywhere within the "xampp" directory structure.

These findings DO NOT instill much confidence in the idea that using said batch files, rather than the Control Panel for starting and stopping "mysqld.exe" offer a better alternative.

This is turning out to be one more of many reasons why I've chosen to keep using Windows 7 as long as possible. I'd like to make some productive use of my Windows 10 computer but at present it is NOT about to function as a testing server. Thankfully it does still work as a client which is a necessary component.
ajax
 
Posts: 35
Joined: 14. December 2010 17:57
Operating System: Windows 2000 Professional

Re: More Regarding MySQL Fails to Start

Postby Nobbie » 19. March 2023 20:02

ajax wrote:These findings DO NOT instill much confidence in the idea that using said batch files, rather than the Control Panel for starting and stopping "mysqld.exe" offer a better alternative.


Why dont you simply read the MySQL (MariaDB) documentation, how to start/stop the server? That is neither "magical", nor any specific to Xampp. Xampp is only a distribution of tools, but finally, you have a totally normal MariaDB installation on your computer (as if you downloaded and installed it from MariaDB, without any knowledge about Xampp) and simply need to follow the original documentation.

All these Xampp GUIs and scripts are meant for people without any skills, but actually they arent needed at all. If youre unhappy with these, simple dont use them. You have a normal MariaDB installation, forget about Xampp. That should make your life much easier. These basic scripts and GUIs arent worth wasting your time. Go for MariaDB directly.
Nobbie
 
Posts: 13171
Joined: 09. March 2008 13:04

Re: More Regarding MySQL Fails to Start

Postby Froosh » 19. March 2023 23:32

The referenced topic suggests that running MySQL as a Windows Service is an effective way to prevent this problem from occurring. I have now looked further into that idea and have learned that it appears as though Windows 10 does NOT intend to allow users to run such programs as a service. In fact, from what I've seen so far it is necessary to install other third party software in order to facilitate such. What have I failed to figure out?


What? I run Windows 11, and have this MySQL (MariaDB), and Apache running as Windows Services. I can just about guaranteed that if I had a Windows 10 system, I could also get this to work. Windows Services are not new, and neither is XAMPP. One thing to be aware of in this situation is that you need to launch XAMPP Control Panel as an administrator to make the configuration change.

I believe the "mysql.ini" file content you cited comes from the "mysql.ini" file in the xampp\mysql\data folder, and not from the xampp\mysql\bin folder. At least on my system, there is a lot more in the bin folder. The on in the data folder has the settings you indicated.
User avatar
Froosh
 
Posts: 138
Joined: 27. March 2022 17:56
XAMPP version: 8.2.0
Operating System: Windows 11 Pro

Re: More Regarding MySQL Fails to Start

Postby ajax » 20. March 2023 19:48

When I open the Component Services application using the Administrative Tools on the Control Panel, I believe all of the current services are listed. They can be selected and lots of controls (start [auto or manual], stop, etc.) manipulated. However, I find no means for adding a new one. Is it possible that you are using the installed verses portable version of XAMPP and that the installer provides some capability to configure it as a Service?

I would expect that Windows uses the Registry as the means for specifying what is a service along with whatever options may apply. While I do know how to edit the Registry, I don't know what Registry Keys might be used for this purpose. Also, I suspect that specifying such a module to be located on a different drive than C: might be considered improper at minimum.

I do start the XAMPP Control Panel (CP) as Administrator. However, I do NOT see anything on the Config dialogue that refers to running as a Service. It does allow to specify Automatic Starting but I think that means when the CP is started.

You are correct about my erroneous interpretation of the code pertaining to the file named "my.ini". I must have been a bit hasty, I now see that the very code I included in this post refers to "/xampp/mysql/bin" rather than "/xampp/mysql/data". I think what happened is that I was aware of and had inspected the file named "my.ini" that was in the "/xampp/mysql/data" directory and assumed that was what was being referred to when it clearly was NOT. The "my.ini" file in "/xampp/mysql/bin" directory is full of lots records specifying different settings. My mistake.
ajax
 
Posts: 35
Joined: 14. December 2010 17:57
Operating System: Windows 2000 Professional

Re: More Regarding MySQL Fails to Start

Postby Nobbie » 20. March 2023 23:14

ajax wrote:I would expect that Windows uses the Registry as the means for specifying what is a service along with whatever options may apply. While I do know how to edit the Registry, I don't know what Registry Keys might be used for this purpose.


So your problem is not Xampp, but the unspeakably poor knowledge about Windows.

Of course, no one has to dig around in the registry to install services, Windows has a system administration and there is, among other things, the possibility to configure services. And that has been the case for at least 20 years.

Instead of pointlessly inferring from one incomprehensible nonsense to the next here, you should maybe start to deal with Windows at some point?!
Nobbie
 
Posts: 13171
Joined: 09. March 2008 13:04

Re: More Regarding MySQL Fails to Start

Postby Altrea » 21. March 2023 13:17

Windows does have a GUI for confugurating an existing service, but no GUI to register or unregister a service.
For this you need to use the sc command in the command line, or New-Service Powershell commandlet.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: More Regarding MySQL Fails to Start

Postby Nobbie » 21. March 2023 13:22

Altrea wrote: but no GUI to register or unregister a service.


In any case, no need to edit the registry manually (as mentioned by "ajax"). Sc.exe has a normal syntax and a help.
Nobbie
 
Posts: 13171
Joined: 09. March 2008 13:04

Re: More Regarding MySQL Fails to Start

Postby ajax » 21. March 2023 19:48

Altrea wrote:Windows does have a GUI for confugurating an existing service, but no GUI to register or unregister a service.
For this you need to use the sc command in the command line, or New-Service Powershell commandlet.


OK! I am NOT familiar with those commands. Thanks.

The command references that I use, such as https://ss64.com/nt/, say that the SC command can create a service. However, those sources did NOT explain how to provide the necessary arguments for doing so. However, in the case of Powershell I was able to create such a service, as shown in the command that follows:

New-Service -name XAMPP-MySQL -binaryPathname W:\xampp\mysql\bin\mysqld.exe -displayName "MySQL from XAMPP" -description "Apache Friends DB Service" -startupType Manual

When it comes to how to delete said service the converse turned out to be the case. I could NOT find a way to do it with Powershell but the SC command did seem to work.

The properties for the service created by the above referenced command can be seen by using the link that follows:
http://gowdygroup.org/HL/Doc/Forum/MySQ ... eProps.jpg

Notice that the start parameters shown on the properties screen were taken from the "start-mysql.bat" file.

Unfortunately, when I try to start the service it fails with an error message shown in the link that follows:
http://gowdygroup.org/HL/Doc/Forum/MySQ ... tError.jpg

My suspicion is that the problem could be related to how to find files that are specified using paths which are relative to what would usually be the current directory. The question I can NOT answer is, "what directory is current when a service is being started?". However, one might think that it would be a good idea for the mysqld.exe to determine what directory it was loaded from and then operate relative to that. The coding in the my.ini file suggests otherwise.

There must be something else I have yet to comprehend if this is supposed to be such an easy thing to do.
ajax
 
Posts: 35
Joined: 14. December 2010 17:57
Operating System: Windows 2000 Professional


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 137 guests