Mysql cannot run after modifying my.cnf? ? ?
仅有的幸福
仅有的幸福 2017-06-06 09:51:57
0
1
611

The following is the entire content of my.cnf:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

Then add two sentences to modify the characters:

[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8

Then it won’t work

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
仅有的幸福
仅有的幸福

reply all(1)
某草草
  • Comment out the two newly added sentences with # and try to see if it can be started (to rule out newly introduced configuration errors)

  • Run mysqld status to view the current startup status of Mysql (excluding failure to start due to not shutting down)

  • Have the permissions of the running user changed? For example, it used root before and now uses user (to rule out permission issues)

If it can be started in the first step, it means there is a problem with the new configuration. Check whether the startup parameters are written incorrectly according to the Mysql version, as shown above.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template