the MySQL service on local computer started and then stopped

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

Can anyone resolve this issue? Thanks.


Solution 1:

After installing it by mysqld --install. Try this mysqld --initialize. We got the same problem but it's now working.

Solution 2:

If using version 8 and you edit the my.ini I found that Notepad is putting 3 hex characters at the beginning of the my.ini file. EF BB BF. Deleting the 3 characters from the beginning of the file in a hex editor fixes the problem.

In version 8 they are accidentally putting Unicode characters in the ini file. This is causing Notepad to save the file with Byte order mark characters.

The following line in the file is the culprit "The line # range from 1 to 2^32 − 1. “Unique” means that each ID must be different." has 3 Unicode characters. This is causing notepad to append the byte order mark to the text file.

Solution 3:

Also remember to give NETWORK SERVICE permission to the folder:

  1. Right-click Data folder
  2. Select Properties
  3. Select Security tab
  4. Click Advanced
  5. Click Change Permissions...
  6. Click Add...
  7. Type NETWORK SERVICE
  8. Click Check Names
  9. Click OK
  10. Select Full Control
  11. Click OK – four times
  12. Start MySQL service

Solution 4:

In my case, I tried to open a DOS prompt and go to the MySQL bin\ directory and issue the below command:

mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" --standalone --console

And it shows me I was missing the "C:\Program Files\MySQL\MySQL Server 5.0\Uploads" folder; I built one and problem solved.