Freshly installed MySQL 5.7/MySQL 8.0, I opened
my.ini in Notepad and made small changes. After saving the changes, I started the MySQL service, but it failed to start. I reverted the changes, saved the file and restarted the MySQL service. But the service failed to start again. Whoa.. this was surprising and at the same time very much frustrating, as I had reverted the changes but still the service won't start.
After spending few hours and reinstalling MySQL again and again, I noticed something weird. I noticed that if you simply open and save
my.ini in Notepad, the filesize was changing. How can the filesize change if you haven't done any edits?
I found that the
ini file had 3 invalid ANSI characters.
The line # range from 1 to 2^32 − 1. “Unique” means that each ID must be different.
As you can see, above line has 3 Unicode characters. And this is causing Notepad to add those extra byte when saving the file without making any edits.
Remove the above line and when saving the file ensure that character encoding is set to ANSI. Restart the MySQL service and Voila!