CentOS7-Mysql5.7配置(五)

2.10.5 Starting and Stopping MySQL Automatically

This section discusses methods for starting and stopping the MySQL server.

Generally, you start the mysqld server in one of these ways:

systemd, the mysqld_safe and mysql.server scripts, Solaris SMF, and the OS X Startup Item (or MySQL Preference Pane) can be used to start the server manually, or automatically at system startup time. systemd,mysql.server, and the Startup Item also can be used to stop the server.

The following table shows which option groups the server and startup scripts read from option files.

Table 2.14 MySQL Startup Scripts and Supported Server Option Groups

<colgroup style="box-sizing: inherit;"><col width="20%" style="box-sizing: inherit;"><col width="80%" style="box-sizing: inherit;"></colgroup>

Script Option Groups
mysqld [mysqld], [server], [mysqld-*major_version*]
mysqld_safe [mysqld], [server], [mysqld_safe]
mysql.server [mysqld], [mysql.server], [server]

[mysqld-*major_version*] means that groups with names like [mysqld-5.6] and [mysqld-5.7] are read by servers having versions 5.6.x, 5.7.x, and so forth. This feature can be used to specify options that can be read only by servers within a given release series.

For backward compatibility, mysql.server also reads the [mysql_server] group and mysqld_safe also reads the [safe_mysqld] group. To be current, you should update your option files to use the [mysql.server] and[mysqld_safe] groups instead.

For more information on MySQL configuration files and their structure and contents, see Section 4.2.2.2, “Using Option Files”.

PREV HOME UP NEXT

User Comments

User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.

Posted by Mike G on February 25, 2016

CAVEAT: If you are trying to run mysql as a user in a non-standard location, and a '/etc/my.cnf' exists that is readable by your user, the 'my_print_defaults' program used in the sample init script will set precedence to the '/etc/my.cnf' file, such that any configuration files you provide will be secondary.

to remedy this in the init script, simply run this sed one-liner:

sed -i 's@extra_args="-e basedir/my.cnf"@extra_args="-cbasedir/my.cnf"@' PATH_TO_YOUR_INIT_SCRIPT

This will force my_print_defaults to look in $basedir for a my.cnf first.

Personally I see this as a flaw - this behavior precludes anyone from using the mysql init scripts to run more than one mysql instance on a machine that happens to have a global installation as well. my_print_defaults should prioritize $basedir/my.cnf over /etc/my.cnf.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,453评论 0 10
  • 1.A simple master-to-slave replication is currently being...
    Kevin关大大阅读 6,014评论 0 3
  • 俗话说:良言一句三冬暖,恶语伤人六月寒。 一句话能建立一个人的自信,也能毁了一个人的自信;一句话能建立一段友谊也能...
    爱之星阅读 594评论 0 0
  • 其实就是让自己瞎忙,然后别思考,别定性。 这么多年,我看着你,爱了又恨,痛了又伤,去年的时候,你还抱着我为别的男孩...
    Dr___Pepper阅读 311评论 0 1
  • 文档对象模型DOM(Document Object Model)定义访问和处理HTML文档的标准方法 本章只是对d...
    简单coder阅读 174评论 0 0