# Why does the PID file rely on the hostname?

**URL:** <https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145>\
**Category:** Other MySQL® Questions\
**Created:** [December 10, 2013, 11:05pm UTC](https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145 "2013-12-10T23:05:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevoro](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/trevoro/32/979_2.png) [@trevoro](https://forums.percona.com/u/trevoro)\
**Post date:** [December 10, 2013, 11:05pm UTC](https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145/1 "2013-12-10T23:05:16Z")

</div>

Hey Everyone,

I was doing some troubleshooting on the init script for the official Percona RPMS and I was wondering about a quirk.  
The PID file passed to mysql is generated based on the hostname value of the server. That means if the server name is changed while the mysql process is running, a “service mysql restart” or “service mysql stop” would fail, as it won’t find the PID file.

I cant think of a good reason why the PID file for a process should be based on an arbitrary value like a hostname.

Is there any reason this was done explicitly?

Thanks!

-Trevor

---

<div class="post-metadata">

**Author:** ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)\
**Post date:** [December 11, 2013, 2:23am UTC](https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145/2 "2013-12-11T02:23:18Z")

</div>

Hi,

Have you installed MySQL by compiling binaries? In this case, it might be possible that default PID file will be like hostname.PID which can cause this issue. You can avoid it by starting mysql with specific pid-file option ([URL][MySQL :: MySQL 5.6 Reference Manual :: 5.1.6 Server Command Options](http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_pid-file%5B/URL%5D)) Or can start mysql with --no-defaults option.

You can also mention PID file path in my.cnf which can override the default settings.

---

<div class="post-metadata">

**Author:** ![trevoro](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/trevoro/32/979_2.png) [@trevoro](https://forums.percona.com/u/trevoro)\
**Post date:** [December 11, 2013, 11:35am UTC](https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145/3 "2013-12-11T11:35:55Z")

</div>

Hey,

No I installed using the “official” percona YUM repository listed here  
[url][Percona Server for MySQL 8.0 - Documentation — Percona Server 8.0 Documentation](http://www.percona.com/doc/percona-server/5.5/installation/yum_repo.html%5B/url%5D)

These RPM packages do not respect the pid-file-path setting in my.cnf. You cannot even over-ride the setting with an /etc/defaults/mysql file or pass extra arguments to the init process because the init script doesn’t source anything.

---

<div class="post-metadata">

**Author:** ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)\
**Post date:** [December 12, 2013, 3:53am UTC](https://forums.percona.com/t/why-does-the-pid-file-rely-on-the-hostname/3145/4 "2013-12-12T03:53:12Z")

</div>

Hi, can you provide exact Percona server version so we can check? Thanks.
