本地计算机上的MySQL服务启动后停止

本地计算机上的MySQL服务启动后停止。

  • 1 报错截图
    • 1.1 idea链接报错提示
    • 1.2 手动启动mysql服务报错提示
  • 2 原因:修改了my.ini配置文件
    • 2.1 my.ini 文件位置
    • 2.2 分析报错日志(.err)文件
      • 2.2.1 路径
      • 2.2.2 报错关键信息
  • 3 解决方案,恢复my.ini然后重启
  • 4 总结,出现以上报错提示,一般是修改了my.ini的问题

1 报错截图

1.1 idea链接报错提示

本地计算机上的MySQL服务启动后停止_第1张图片
报错信息:

[08001] Could not create connection to database server. Attempted reconnect 3 times.
 Giving up.
 java.net.ConnectException: Connection refused: connect. 

1.2 手动启动mysql服务报错提示

本地计算机上的MySQL服务启动后停止_第2张图片
报错信息:

MYSQL启动报错:本地计算机上的mysql57服务启动后停止。某些服务在未由.....

2 原因:修改了my.ini配置文件

至于为何修改my.ini会导致这种错误。未知。

2.1 my.ini 文件位置

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

原始my.ini内容(mysql57)

# Other default tuning values
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory 
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option 
# "--defaults-file". 
#
# To run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guidelines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
# For advice on how to change settings please see
# https://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------

你可能感兴趣的:(mysql,mysql)