我将/usr/local/mysql/support-files/my-default.cnf
复制到/etc/my.cnf
,并将其内容更改为:
[client]
default-character-set=utf8
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
default-character-set=utf8
init_connect='SET NAMES utf8'
但是我的MySQL现在无法启动:
修改-1
my.cnf
,因此MySQL使用默认的配置。 /usr/local/mysql/support-files/my-default.cnf
只有这一行:
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
其他所有行都被评论。
我只改为上面的代码。
修改-2
我使用命令(sudo $(ps auxww|sed -n '/sed -n/d;/mysqld /{s/.* \([^ ]*mysqld\) .*/\1/;p;}') --verbose --help|grep '^log'
)获取以下信息:
aircraftdeMacBook-Pro:etc ldl$ sudo $(ps auxww|sed -n '/sed -n/d;/mysqld /{s/.* \([^ ]*mysqld\) .*/\1/;p;}') --verbose --help|grep '^log'
log-bin (No default value)
log-bin-index (No default value)
log-bin-trust-function-creators FALSE
log-bin-use-v1-row-events FALSE
log-builtin-as-identified-by-password FALSE
log-error stderr
log-error-verbosity 1
log-isam myisam.log
log-output FILE
log-queries-not-using-indexes FALSE
log-raw FALSE
log-short-format FALSE
log-slave-updates FALSE
log-slow-admin-statements FALSE
log-slow-slave-statements FALSE
log-statements-unsafe-for-binlog TRUE
log-syslog FALSE
log-syslog-facility daemon
log-syslog-include-pid TRUE
log-syslog-tag
log-tc tc.log
log-tc-size 24576
log-throttle-queries-not-using-indexes 0
log-timestamps UTC
log-warnings 0