The Problem
When you start the MySQL80 service, it immediately stops and gives the following error:

The MySQL80 service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.
“The MySQL80 service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.”
The solution I came across was ridiculously simple but took me a while to find, so I thought I would make another resource online to hopefully save you some time and trouble. I found a lot of sites that mentioned installing MySQL as a service using mysqld –install and then running mysqld –initialize , but I wouldn’t start there.
The Solution
Somehow the my.ini config file can get HEX characters added to the beginning of the file. At least on Windows servers, this causes the MySQL service to fail when it tries to start. The solution is to remove these HEX characters and then start the service again.
Since HEX characters aren’t visible if you’re using a regular text editor, like the built-in Notepad, you’ll have to install another program.
The solution I found was mentioned at https://docs.rackspace.com/support/how-to/how-to-resolve-mysql-service-starting-and-stopping-unexpectedly/
Steps to Fix MySQL80 Service
When you open your my.ini config file (on Windows, found in C:\ProgramData\MySQL\MySQL Server 8.0 –> you might have a different server version number), you don’t immediately notice the HEX characters unless you view it with a HEX viewer.

Using Notepad++
One of the simplest ways to get a HEX view of your my.ini file is to use Notepad++ and run the “HEX-Editor” plugin. If you’re not already using Notepad++ for all your text editor needs…you should be. Download Notepad++ here.
Once you’re running Notepad++, you can add the HEX-Editor plugin. In Notepad++, click Plugins -> Plugins Admin… -> search for “HEX”. You’ll see “HEX-Editor” as one of the plugins you can install. Select it and click Install.
Notepad++ should close, install the plugin, then restart. Once you have it open again, open your my.ini config file in Notepad++, click Plugins -> HEX-Editor -> View in HEX.

Remove the HEX Characters
When I viewed my.ini in HEX view, I had 3 HEX characters before the initial “#” symbol that I saw when I viewed my.ini in a regular text editor like Notepad (or Notepad++ without HEX view turned on).

Select any leading HEX characters and press “Delete” on your keyboard. I don’t remember specifically, but you may also be able to right-click on your selection and click Delete. Either way, make those HEX characters disappear and then save your file. The config file should start with the “#” symbol.

Have a Party
Now that you’ve removed the HEX characters and saved your my.ini config file again, you should be able to start the MySQL80 service again. Then you should celebrate and have a cup of coffee.
Note: This may also apply to other versions of MySQL, but the one I specifically encountered this with was MySQL version 8.0.26.
Leave a Comment
I hope this helps you. I thanked God when I came across this fix! It saved me a day of reinstalling and restoring data 🙂
Reach out to me directly or leave a comment below if you need any help or have any questions.
This procedure save my career. LoL
Thanks OP.
Hey JR! I’m glad that helped you!
Thank you so, so much! You literally saved many game servers tonight!
Great! Glad that helped. Happy gaming!
Thank you!
You’re welcome!
Very helpful! Thanks!
Awesome! Glad I could help.
very helpful thanks a lot
Glad this helped you!
Yessss this is my solution thank you thank you thank yoouuuuuu
Glad it helped you too!
This is very helpful. Thank you very much. you saved my day!!
So glad this helped you! 🙂
Genius, God Bless you. You saved me.
To God be the glory Glad this helped you!
i opened the ini file but i just dont know what to delete can you please help
my file looks fine (no hex before #) yet i still cant start the service, im so lonely and depressed
Hi Nabil,
I’m sorry this fix didn’t work for you. I’m not sure what the problem could be. If you’d like to message me directly, click the Contact link on this site, or feel free to leave another comment. It would be helpful to know the error message you’re receiving, too.
Thanks,
Brad
Thank you very much, may god always bless you
You’re welcome! God bless you, too!
Thank You!
I would never have found it!
Yeah, such a sneaky issue 🙂 I’m glad it helped you, too!
this doesnt work for me, i got the same error message. i dont have problem with this file.
appreciate anyones help. have been trying but to no avail. my previous fix was uninstall and reinstall.
Hi Jimmy, I’d need some more information. Feel free to comment here or reach out to me directly on the Contact form on this site.
I’m having problems deleting the hex characters..the main characters are moving along with the hex making it difficult for me to delete
You should be able to select the leading Hex characters on the right side of the screen (under the “Dump” column), right-click, Delete.
this was huge help, never knew such a bug could exist.
Hi Mogan, I’m glad that helped. Yes, it was quite the odd bug. 🙂
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Glad it helped!
Man, incredible! Thanks a lot! I recently made a backup of my.ini so instead of download a programa to remove those characters I simply recovered from backup and it worked! thanks a lot!
Awesome! Glad that helped. And yes, backups are great for things like this. Way to go!
Thank you so much.. It’s really helped me
Great! Glad it helped.
Hi Brad, I’ve followed your steps but my file doesnt have any leading hex characters to remove. When starting the MySQL service I am getting the exact same error as your post talks about. What I am trying to do is to change the path of the data directory for MySQL (no more space on C drive, so trying to switch to remote F drive). I have copy-pasted the whole Data folder to the new target path also. I’d be grateful for any tips on this! Thanks:)
Hey Peter! It may be as simple as editing a value in your my.ini file. Look for “datadir” and update that to point to the new location.