# Percona Server 57 when start, delete socket and pid-file

**URL:** <https://forums.percona.com/t/percona-server-57-when-start-delete-socket-and-pid-file/5394>\
**Category:** Other MySQL® Questions\
**Created:** [February 4, 2017, 3:07am UTC](https://forums.percona.com/t/percona-server-57-when-start-delete-socket-and-pid-file/5394 "2017-02-04T03:07:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tvink.odin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tvink.odin/32/1158_2.png) [@tvink.odin](https://forums.percona.com/u/tvink.odin)\
**Post date:** [February 4, 2017, 3:07am UTC](https://forums.percona.com/t/percona-server-57-when-start-delete-socket-and-pid-file/5394/1 "2017-02-04T03:07:46Z")

</div>

Hello.

I want to migrate from mysql-server to Percona server.

My actions:

service mysqld stop

rpm --nodeps -e mysql-server mysql

yum install Percona-Server-server-57 Percona-Server-client-57 Percona-Server-shared-57 Percona-Server-shared-compat percona-toolkit xtrabackup perl-DBD-MySQL php-mysql MySQL-python

Затем, я заменил сокет с /var/lib/mysqld/mysqld.sock на /var/lib/mysql/mysql.sock  
и pid-file = /var/run/mysql/mysql.pid на pid\_file = /var/run/mysql/mysql.pid

service mysql start

And the server is running.

Next, I want to optimize the server and create a config file using percona tools for mysql.

My resulting configuration:

[mysql]

# CLIENT

port = 3306  
socket = /var/lib/mysql/mysql.sock

[mysqld]

# GENERAL

user = mysql  
default-storage-engine = InnoDB  
socket = /var/lib/mysql/mysql.sock  
pid-file = /var/lib/mysql/mysql.pid

# MyISAM

key-buffer-size = 32M  
myisam-recover = FORCE,BACKUP

# SAFETY

max-allowed-packet = 16M  
max-connect-errors = 1000000

# DATA STORAGE

datadir = /var/lib/mysql/

# BINARY LOGGING

log-bin = /var/lib/mysql/mysql-bin  
expire-logs-days = 14  
sync-binlog = 1

# CACHES AND LIMITS

tmp-table-size = 32M  
max-heap-table-size = 32M  
query-cache-type = 0  
query-cache-size = 0  
max-connections = 500  
thread-cache-size = 50  
open-files-limit = 65535  
table-definition-cache = 1024  
table-open-cache = 2048

# INNODB

innodb-flush-method = O\_DIRECT  
innodb-log-files-in-group = 2  
innodb-log-file-size = 512M  
innodb-flush-log-at-trx-commit = 1  
innodb-file-per-table = 1  
innodb-buffer-pool-size = 432P

# LOGGING

log-error = /var/lib/mysql/mysql-error.log  
log-queries-not-using-indexes = 1  
slow-query-log = 1  
slow-query-log-file = /var/lib/mysql/mysql-slow.log

When I try to restart mysql, I receive an error

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Socket file and pid-file no. If I create them manually, I get the same error, and no file again.

---

<div class="post-metadata">

**Author:** ![przemek](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/przemek/32/3_2.png) [@przemek](https://forums.percona.com/u/przemek)\
**Post date:** [April 18, 2017, 7:22am UTC](https://forums.percona.com/t/percona-server-57-when-start-delete-socket-and-pid-file/5394/2 "2017-04-18T07:22:48Z")

</div>

Hello,

You don’t have to change the pid nor socket file name/location - it’s not an “optimization” really but just an example.  
When the server is still running with the former settings, and you edit the my.cnf file with new pid and socket location, the init script will read the new ones already, hence it will fail to find the running server’s real ones. You may however shutdown the MySQL instance by giving the socket location explicitly with

```auto
mysqldadmin -S $file shutdown

```
