搜尋

首頁  >  問答  >  主體

修改my.cnf後mysql無法運作? ? ?

下面是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/

然後加入修改字元的兩句話:

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

然後就不能運行了

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

全部回覆(1)我來回復

  • 某草草

    某草草2017-06-06 09:53:57

    • 把新加入的兩句話用#註解掉試一下,能不能啟動(排除新引入配置出錯)

    • 運行mysqld status查看Mysql目前啟動狀態(排除因未關閉導致無法啟動)

    • 運行使用者權限是否發生變化,如之前用root,現在用user(排除權限問題)

    如果第一步就可以啟動,表示新配置有問題,根據回應Mysql版本查一下啟動參數是不是寫錯,以上。

    回覆
    0
  • 取消回覆