mysql pid文件位置
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
- 点赞
- 收藏
- 关注作者
评论(0)