下面是我的MySQL配置文件。我试图了解它是如何工作的。 [mysqld_safe]
有什么意义?还没有[mysqld]
已启动MySQL吗?为什么之后会出现日志错误和pid文件设置?
[mysqld]
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so
# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
innodb_strict_mode=on
sql_mode=TRADITIONAL
;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE
character-set-server=utf8
collation-server=utf8_general_ci
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
答案 0 :(得分:9)
您可以使用mysqld
或mysqld_safe
启动MySQL服务器。 mysqld_safe
本身可能会尝试执行mysqld
,但也可能不会。请参阅documentation( Google中的第一个结果 mysqld_safe, btw ):
mysqld_safe是在Unix和NetWare上启动mysqld服务器的推荐方法。 mysqld_safe添加了一些安全功能,例如在发生错误时重新启动服务器并将运行时信息记录到错误日志文件中。特定于NetWare的行为将在本节后面列出。
配置文件中的[mysqld_safe]
部分适用于使用mysqld_safe
启动MySQL服务器而不是mysqld
时应用的设置。