MySQL Could not create unix socket lock file
When trying to reset MySQL 8 user root password, I got the following error message in the log file (/var/log/mysql/error.log).
[System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29-0ubuntu0.20.04.3) starting as process 265880 [System] [MY-013576] [InnoDB] InnoDB initialization has started. [System] [MY-013577] [InnoDB] InnoDB initialization has ended. [ERROR] [MY-011292] [Server] Plugin mysqlx reported: 'Preparation of I/O interfaces failed, X Protocol won't be accessible' [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock' [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. [ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock. [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file. [ERROR] [MY-010119] [Server] Aborting [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29-0ubuntu0.20.04.3) (Ubuntu).
The error is
[ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
To fix the error, create the folder, and change its ownership to user “mysql”.
mkdir /var/run/mysqld/ chown mysql:mysql /var/run/mysqld/