Lucy
Lucy

Reputation: 480

MySQL service could not be started after changing my.ini

I have MySQL 8.0 running on Windows. I made some changes to my.ini (having eventually found it!) to change the character set. Stupidly I did not back it up first, and I used Notepad, which doesn't have multiple undo.

Now I get

 The MySQL Service could not be started

 The service did not report an error

There are no errors logged in the MYSQL log either.

I'm sure I've accidentally deleted an important line or something, but can't for the life of me find it. This is the section of my.ini that I changed:

[client]

# pipe=

# socket=MYSQL

port=3306


[mysql]





# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=2
[mysqld]


# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking
# enable-named-pipe
# shared-memory

# shared-memory-base-name=MYSQL

# The Pipe the MySQL Server will use
# socket=MYSQL

# The TCP/IP Port the MySQL Server will listen on
port=3306

# Path to installation directory. All paths are usually resolved relative to this.
# basedir="C:/Program Files/MySQL/MySQL Server 8.0/"

# Path to the database root
datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data

# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8

I've tried undoing what I did (though as I say, I may have accidentally changed something else), and using mysqld --initialize before trying to restart. I've checked permissions - all seem to be OK.

Upvotes: 10

Views: 10413

Answers (4)

Terrell Plotzki
Terrell Plotzki

Reputation: 2034

In my case datadir was a UNC share. Noticed that saving in ANSI some of the \ characters were escaping in the Event log

datadir=\\unc-path\folder$\MySql\Data

had to change to

datadir=\\\\unc-path\folder$\MySql\Data

Upvotes: 0

JamesPhat
JamesPhat

Reputation: 41

I had a different problem but your solution helped me narrow down my solution. Saved innodb_buffer_pool_size= 3G instead of innodb_buffer_pool_size=3G That small spacing caused me a heart attack. After removing the space and saving it as UTF-8 file. It worked for me again

Upvotes: 2

lexma
lexma

Reputation: 449

Saving the file to ANSI will fix the issue.

Upvotes: 7

Lucy
Lucy

Reputation: 480

I found the answer. The problem wasn't to do with my changes at all, but because I had changed it in Notepad. When I opened the file in Notepad++ to check encoding, I noticed that the encoding was UTF-8-BOM.

I changed it to plain UTF-8 and MySQL now starts. I'm not sure if Notepad changed it, or just didn't encode the UTF-8-BOM correctly, but the main thing is that it starts.

Upvotes: 34

Related Questions