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

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.

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

mysqldadmin -S $file shutdown