Where is mysql configuration file on windows?

Where is mysql configuration file on windows?

Hey All. I recently had a requirement to install a Jamf Software Server to an on-premise Windows Server. Typically, this is not something we’d do at dataJAR, preferring to host customers on our own .mobi platform.

As part of the installation process, I had to make some tweaks to the MySQL configuration file, located at  C:\ProgramData\MySQL Server 8.x\my.ini. Typically, I’d download and use the Notepad++ free source code editor to ensure that the file remains in plain text (ANSI) and no fancy “smart” quotes or dashes are added. However as this was to only be a few edits, I decided to just rock-on with the built in Notepad App.

I made a copy of the file, made my edits as per the Jamf documentation, saved and restarted MySQL.

The service failed to start…

Huh? I must have screwed something up

My first thought was I must have used an unexpected value somewhere or otherwise ‘fat-fingered’ the changes. I restored the original copy of the file and the service started fine.

I went back in, made my changes again (being extra careful) , saved the file and restarted MySQL.

The service failed to start again…

Weird

Ok, I restored my backup file, restarted MySQL and all worked again.

This time I opened the file in Notepad, made no changes and re-saved the file. I restarted MySQL and…

The service failed to start again!

Help from the Interwebs

As with most IT issues, I did a quick Google search to try and find if someone else had the same issue. After some digging and lots of trying of ideas, I came across this post.

It turns out the default MySQL 8.0 my.ini file on Windows has some text that Notepad transforms into non-ANSI characters when you save the file, rendering the configuration file invalid!

The line in question contains the following:

1. “Unique” means that each ID must be different.

Those double quotes get changed to “smart” or curly quotes and the file is saved as non-ANSI.

The fix, or TL;DR

Either edit the file using the command line, or a code editor like Notepad++, or remove that line and have Notepad Save-As the file as ANSI.

After this, restart MySQL and the service starts as expected!

Summary

This post covers a workaround when installing MySQL 8.0+ on Windows and editing the configuration file causes the service not to start. As always, if you have any questions, queries or comments, let me know below (or @daz_wallace on Mac Admins Slack) and I’ll try to respond to and delve into as many as I can.

Standard

I'm running MySQL Server 5.6 on Windows 7 and would like to enable slow query logging. Unfortunately, it is not immediately obvious to me where the my.cnf file is.

I see C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini but according to that...

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

I don't see any my.cnf or my.ini file in C:\Users\neubert\AppData\Roaming\MySQL either.

Any ideas?

asked Jan 22, 2016 at 4:35

Here's the location with MySQL Server 5.7:

C:\ProgramData\MySQL\MySQL Server 5.7\my.ini

answered Apr 2, 2017 at 21:28

neubertneubert

6,12131 gold badges71 silver badges128 bronze badges

If an ini file exists it will be in

c:\Windows

It's typically named

my.ini

answered Jan 22, 2016 at 20:07

Where is mysql configuration file on windows?

DaveDave

2662 silver badges7 bronze badges

How do I find MySQL configuration file?

Support Network.
Find the configuration files. By default, you can find the MySQL® configuration files in: /etc/mysql. ... .
my. cnf configuration file. ... .
Log files. Log files are the best place to start troubleshooting any program. ... .
mysqld and mysqld_safe. ... .
mysqladmin. ... .
Backups. ... .
Database engine. ... .
Related articles..

Where is the main location of the MySQL configuration?

On RH systems, MySQL configuration file is located under /etc/my. cnf by default.

What is configuration file of MySQL?

Table 4.2 Option Files Read on Unix and Unix-Like Systems.