ls /var/run/mysqld/ – should show below
-rw-r----- 1 mysql mysql 8 Apr 11 07:34 mysqld.pid
srwxrwxrwx 1 mysql mysql 0 Apr 11 07:34 mysqld.sock=
-rw------- 1 mysql mysql 7 Apr 11 07:34 mysqld.sock.lock
srwxrwxrwx 1 mysql mysql 0 Apr 11 07:34 mysqlx.sock=
-rw------- 1 mysql mysql 7 Apr 11 07:34 mysqlx.sock.lock
If not
cd /etc/mysql/mysql.conf.d
sudo vi mysqld.cnf
#unhash the single line - its right near the top below the user = mysql line.
pid-file = /var/run/mysqld/mysqld.pid
sudo service mysql stop
sudo service mysql start
ls /var/run/mysqld/
should now contain the PID file as above
Oddly the following has happened to me, I do not know why and am not really phased.
Do not be in the folder /var/run/mysqld when doing the restart this for what ever reason has ended with none of the files get created not even the lock files. However the databases were up.
After leaving the directory and restarting the Mysql service all files created perfectly on multiple restarts.