I get this error and I’m not able to start the MySQL server. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
I followed this guide here https://www.digitalocean.com/community/tutorials/how-to-troubleshoot-socket-errors-in-mysql
But I found that I don’t even have the /var/run/mysqld/ directory When I try to cd or ls that directory, it shows the directory does not exist.
I guess my own case is different, I browsed around the internet and found this solution that suggested I add
innodb_force_recovery = 6
After adding that code, it still does not solve the problem
When I go into the /var/log/mysql/error.log file I get this
2022-08-08T01:40:28.108418Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu). 2022-08-08T01:40:28.677008Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 271100 2022-08-08T01:40:28.688821Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2022-08-08T01:40:28.928619Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2022-08-08T01:40:29.023994Z 1 [Warning] [MY-011018] [InnoDB] Skip updating information_schema metadata in InnoDB read-only mode. 2022-08-08T01:40:29.229659Z 1 [Warning] [MY-010005] [Server] Skip re-populating collations and character sets tables in InnoDB read-only mode. 2022-08-08T01:40:29.235974Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. 2022-08-08T01:40:29.236037Z 0 [ERROR] [MY-010119] [Server] Aborting 2022-08-08T01:40:29.760446Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
I would appreciate any help I can get regarding this, thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
Can you try to examine the server logs in order to track down more detailed information bout the issue?
On Ubuntu systems, the default location for MySQL is
/var/log/mysql/error.logIn many cases, the error logs are most easily read with the less program, a command line utility that allows you to view files but not edit them:
If MySQL isn’t behaving as expected, you can obtain more information about the source of the trouble by running this command and diagnosing the error based on the log’s contents.
You can also use the
innodb_force_recoveryis added to the
my.cnffile in case of InnoDB corruption, but you need to use that as a last resort option.