Up until recently MySQL was working perfectly fine, then all of a sudden started throwing errors. I have done nothing but add and delete tables. When trying to login to MySQL as root I get
> ERROR 2002 (HY000): Can't connect to local MySQL server through
> socket /var/run/mysqld/mysqld.sock
After looking into this, the file mysqld.sock does not exist. So I tried creating it by touching it to the location specified in the error. This initially worked, but the file eventually just disappears. However, even when this worked I was unable to connect to the server as it was not active (which it should have been).
I then tried to restart the service but get this error:
>Job for mysql.service failed because the
>control process exited with error code.
>See "systemctl status mysql.service" and "journalctl -xe" for details.
Upon inspecting journal ctl, I get no helpful error messages/information:
>The job identifier is 98255 and the job result is done. Mar 15
>
>13:02:22 *myusername* systemd[1]: mysql.servi> Mar 15 13:02:22
>*myusername* systemd[1]: mysql.servi>
> Subject: Unit failed
> Defined-By: systemd
> Support: http://www.ubuntu.com/support
>
> The unit mysql.service has entered the 'failed' state with result 'exit-code> Mar 15 13:02:22 *myusername*
> systemd[1]: Failed to start
> Subject: A start job for unit mysql.service has failed
> Defined-By: systemd
> Support: http://www.ubuntu.com/support
>
> A start job for unit mysql.service has finished with a failure.
>
> The job identifier is 98255 and the job result is failed
The results from systemctl status mysql.service are slightly more helpful; I am assuming that the error at the end is what is stopping the server from running, but I have no idea why I'm getting a permission denied error when using root/sudo to execute commands.
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
Active: failed (Result: exit-code) since Tue 2022-03-15 13:02:22 GMT; 7min>
Process: 95405 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=>
Process: 95413 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 95413 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 13 (Permission denied)
I have tried every solution I could find and none have worked. I am absolutely baffled as to why this is happening and why nothing fixes it. I am running Ubuntu 20.04 and using sudo/root to execute all commands.
Any and all advice is very much appreciated thank you.