mysql pid文件位置

举报
snowofsummer 发表于 2021/04/29 07:36:14 2021/04/29
【摘要】 pid-file=file_nameThe path name of the file in which the server should write its process ID. The server creates the file in the data directory unless an absolute path name is given to specify a dif...

pid-file=file_name

The path name of the file in which the server should write its process ID. The server creates the file in the data directory unless an absolute path name is given to specify a different directory.

If this option is not given, mysql.server uses a default value of host_name.pid. The PID file value passed to mysqld_safe overrides any value specified in the [mysqld_safe] option file group. Because mysql.server reads the [mysqld] option file group but not the [mysqld_safe] group, you can ensure that mysqld_safe gets the same value when invoked from mysql.server as when invoked manually by putting the same pid-file setting in both the [mysqld_safe] and [mysqld] groups.

//4.3.3 mysql.server — MySQL Server Startup Script
https://dev.mysql.com/doc/refman/5.7/en/mysql-server.html


[mysqld]
port=3333
datadir=/3333/data
socket=/3333/mysql.sock
[mysqld_safe]
log-error=/3333/log/db.log
pid-file=/3333/run/db.pid

手动启动:
./bin/mysqld_safe --defaults-file=/3333/my.cnf &
pid读取mysqld_safe参数文件:
ps -ef|grep 3333
root     25278 12625  0 23:10 pts/1    00:00:00 /bin/sh ./bin/mysqld_safe --defaults-file=/3333/my.cnf
mysql    25409 25278  1 23:10 pts/1    00:00:00 /mysql/3333/bin/mysqld --defaults-file=/3333/my.cnf --basedir=/mysql/3333 --datadir=/3333/data --plugin-dir=/mysql/3333/lib/plugin --user=mysql --log-error=/3333/log/db.log --pid-file=/3333/run/db.pid --socket=/3333/mysql.sock --port=3333

使用mysql.server脚本启动
uses a default value of host_name.pid,The server creates the file in the data directory 。
###pid参数文件默认指定位置,为数据文件目录,主机名称命名。
[root@VM-16-10-centos 3333]# ps -ef|grep 3333
root     26111     1  0 23:13 pts/1    00:00:00 /bin/sh /mysql/3333/bin/mysqld_safe --datadir=/3333/data --pid-file=/3333/data/VM-16-10-centos.pid
mysql    26269 26111  0 23:13 pts/1    00:00:00 /mysql/3333/bin/mysqld --basedir=/mysql/3333 --datadir=/3333/data --plugin-dir=/mysql/3333/lib/plugin --user=mysql --log-error=/3333/log/db.log --pid-file=/3333/data/VM-16-10-centos.pid --socket=/3333/mysql.sock --port=333

需要在mysqld指定pid-file参数:
[mysqld]
port=3333
datadir=/3333/data
socket=/3333/mysql.sock
pid-file=/3333/run/db3333.pid
[mysqld_safe]
log-error=/3333/log/db.log
pid-file=/3333/run/db.pid

###文件位置为mysqld参数的pid-file位置:
ps -ef|grep 333
root     13339 13329  0 22:24 pts/2    00:00:00 -bash
root     27942     1  0 23:20 pts/1    00:00:00 /bin/sh /mysql/3333/bin/mysqld_safe --datadir=/3333/data --pid-file=/3333/run/db3333.pid
mysql    28114 27942  7 23:20 pts/1    00:00:00 /mysql/3333/bin/mysqld --basedir=/mysql/3333 --datadir=/3333/data --plugin-dir=/mysql/3333/lib/plugin --user=mysql --log-error=/3333/log/db.log --pid-file=/3333/run/d3333.pid --socket=/3333/mysql.sock --port=3333


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。