MySQL mysqld_safe 在 my.cnf 中有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16873118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does mysqld_safe do in my.cnf?
提问by user1032531
Below is my MySQL config file. I am trying to understand how it works. What is the point of [mysqld_safe]
? Hasn't [mysqld]
already start MySQL? Why is the log-error and pid-file settings after it?
下面是我的 MySQL 配置文件。我试图了解它是如何工作的。重点是[mysqld_safe]
什么?还没有[mysqld]
启动 MySQL?为什么日志错误和pid-file设置在它之后?
[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
采纳答案by Mifeet
You can start MySQL server using either mysqld
or mysqld_safe
. mysqld_safe
may itself try to execute mysqld
but also may not. See the documentation(the first result in Google formysqld_safe, btw):
您可以使用mysqld
或启动 MySQL 服务器mysqld_safe
。mysqld_safe
本身可能会尝试执行,mysqld
但也可能不会。请参阅文档(在 Google 中的第一个结果mysqld_safe,顺便说一句):
mysqld_safe is the recommended way to start a mysqld server on Unix and NetWare. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file. NetWare-specific behaviors are listed later in this section.
mysqld_safe 是在 Unix 和 NetWare 上启动 mysqld 服务器的推荐方法。mysqld_safe 添加了一些安全功能,例如在发生错误时重新启动服务器并将运行时信息记录到错误日志文件中。本节后面列出了 NetWare 特定的行为。
Section [mysqld_safe]
in the configuration file is for settings applied when you use mysqld_safe
to start MySQL server instead of mysqld
.
部分[mysqld_safe]
配置文件中是应用的设置,当您使用mysqld_safe
启动MySQL服务器,而不是mysqld
。