Solution for WIN 10 Localhost MYSQL Failed To Start or Started Stopped Error

Solution for WIN 10 Localhost MYSQL Failed To Start or Started Stopped Error

When installing MySQL in Windows operating system, the default installation directory is "C: \ Program Files \ MySQL \ MySQL Server x.x". However, the directory where the database files will be stored may differ depending on the Windows operating system version, not under the installation directory. If you are going to do a new installation, we do not need to download and install individual installations to be able to work on PHP and MySQL. Because Appserv makes them one installation for us. If you request how the Appserv setup is, write in the comments section, let's add it as soon as possible.

 

It is a fact that working at Localhost is indispensable for PHP application developers. One of the sine qua non while preparing our projects is the trial phase, at this point PHP servers running in Local come to our rescue. Since setting up a normal PHP + MySQL server is quite troublesome, it makes much more sense to install ready-made PHP + MySQL servers that can run on different operating systems.

 

Now let's get to our main subject;

 

Whether you have localhosta with ready-made servers or installed directly, you once looked at your MySQL installation while it was running and it does not work and gives the following error:


 

MySQL service on local computer started and then stopped. Some services automatically stop if they are not used by other services or programs.

 

Well, you got this error, even if you tried hard to fix it, didn't you? You continue to get the same error even though you come to the services and say restart the MYSQL service. Yes, the exact solution to this problem is as follows;

 

Using Community 8.0.17, upgraded from 8.0.16

There may be a more secure way of doing this, but since I'm just running a dev box:

  1. navigate to the \data folder
  2. make SURE the \data folder is EMPTY. If files exist the --initialize option will fail
  3. give SYSTEM Full Control permissions on the \data folder
  4. go back to your command prompt
  5. run mysqld --initialize

 

You will now see all the necessary data file structures in the data folder. There is a write-to-folder authorization restriction for mysqld if they are not created. If it has been created, if the authorities are open, it is definitely created, now you can run your MySQL service easily.

my.ini files adding:

 

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4

 

 

Respects...