← Back to team overview

maria-discuss team mailing list archive

Re: mysqld_safe and pid files


On 9/26/2017 2:03 PM, Ruben Safir wrote:
> hello monty et al
> i'm trying to write an init script for maria and artix, which is using openrc
> I got it to start up but the pid-file is a problem and I think that the 
> command line options for mysqld_safe is not working.  it doesnt 
> create the specified pid file

Gentoo's OpenRC startup script does not use mysqld_safe because of such
We have start-stop-daemon create the pidfile and call mysqld directly

Alternatively, OpenRC's supervise-daemon could be used if one wanted to
have the server "always available", but I believe that a database crash
should be investigated by an admin.

> [www3 ~]# tail -f /usr/local/var/www3.err
> 2017-09-26 10:41:53 139828287336192 [Note] InnoDB: 128 rollback segment(s) are active.
> 2017-09-26 10:41:53 139828287336192 [Note] InnoDB: Waiting for purge to start
> 2017-09-26 10:41:53 139828287336192 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.0 started; log sequence number 1601111
> 2017-09-26 10:41:53 139828287336192 [Note] Plugin 'FEEDBACK' is disabled.
> 2017-09-26 10:41:53 139827658368768 [Note] InnoDB: Dumping buffer pool(s) not yet started
> 2017-09-26 10:41:53 139828287171328 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist
> 2017-09-26 10:41:53 139828287336192 [Note] Server socket created on IP: '::'.
> 2017-09-26 10:41:53 139828286868224 [ERROR] mysqld: Can't create/write to file '/run/mariadb.pid' (Errcode: 13 "Permission denied")
> 2017-09-26 10:41:53 139828286868224 [ERROR] Can't start server: can't create PID file: Permission denied
> 170926 10:41:53 mysqld_safe mysqld from pid file /run/mariadb.pid ended

MySQL and MariaDB attempt to create the pidfile as the user that mysqld
is running as.. which may be a potential security issue if that user is


Follow ups