更改my.ini后无法启动MySQL服务

时间:2019-05-02 10:36:38

标签: mysql

我在Windows上运行MySQL 8.0。我对my.ini进行了一些更改(最终找到了它!)以更改字符集。愚蠢的是,我没有先备份它,而是使用了记事本,该记事本没有多次撤消。

现在我得到

 The MySQL Service could not be started

 The service did not report an error

MYSQL日志中也没有记录错误。

我确定我不小心删除了重要的一行或其他内容,但是我一生都找不到。这是我更改的my.ini部分:

[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

我尝试撤消所做的工作(尽管正如我所说,我可能不小心更改了其他内容),并在尝试重新启动之前使用mysqld --initialize。我已经检查了权限-一切似乎都还可以。

1 个答案:

答案 0 :(得分:1)

我找到了答案。问题根本与我所做的更改无关,而是因为我已在记事本中进行了更改。当我在Notepad ++中打开文件以检查编码时,我注意到编码为UTF-8-BOM。

我将其更改为普通UTF-8,现在开始运行MySQL。我不确定记事本是否更改了它,或者只是没有正确编码UTF-8-BOM,但主要是它开始了。