The mysql.sock is deleted when the mysql service is stopped and mysqld_safe can’t create it. A solution is to back up the sock folder and restore before starting mysqld_safe
Start server
$ sudo service mysql start
Go to sock folder
$ cd /var/run
Back up the sock
$ sudo cp -rp ./mysqld ./mysqld.bak
Stop server
$ sudo service mysql stop
Restore the sock
$ sudo mv ./mysqld.bak ./mysqld
Start mysqld_safe
$ sudo mysqld_safe --skip-grant-tables --skip-networking &
Init mysql shell
mysql -u root
Change password
FLUSH PRIVILEGES;
SET PASSWORD FOR root@'localhost' = PASSWORD('my_new_password');