I am currently facing the following error when I run the tail command on the error log.
root@sendy-droplet:/# tail -30 /var/log/mysql/error.log
2022-08-02T21:45:40.816581Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3049
2022-08-02T21:45:40.830054Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:45:40.831372Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:45:40.831393Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:45:40.831805Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
2022-08-02T21:46:00.633544Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3093
2022-08-02T21:46:00.643248Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:46:00.643353Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:46:00.643374Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:46:00.643903Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
2022-08-02T21:46:01.295373Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3110
2022-08-02T21:46:01.306837Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:46:01.306949Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:46:01.306962Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:46:01.307391Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
2022-08-02T21:46:02.066704Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3120
2022-08-02T21:46:02.075175Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:46:02.075298Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:46:02.075314Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:46:02.075803Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
2022-08-02T21:46:02.791184Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3130
2022-08-02T21:46:02.798780Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:46:02.798883Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:46:02.798897Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:46:02.799347Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2) (Ubuntu).
2022-08-02T21:46:03.555588Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 3140
2022-08-02T21:46:03.563822Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2022-08-02T21:46:03.563917Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-02T21:46:03.563930Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-02T21:46:03.564373Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-0ubuntu0.20.04.2)
I am really not sure how I got here as everything was running until I got an error that I couldn't connect to the db anymore. I have tried starting into safe mode using
mysqld_safe --skip-grant-tables&
it runs but the moment I try to enter anything from mysql it fails (same error as above). Everything in the conf files are fine and my next step is trying to do a forced recoevery using
innodb_force_recovery=1
however I have read that it can be possibly dangerous running these commands (and increasing the number) so before I run it I wanted to double check with the community first to see if they have any idea what could be causing this/maybe another fix? And if innodb_force_recopvery=1 is ok to try out.
As well I can see the data files (meaning the idb files) in the data folder and they have data in it (due to there size) so I know there must be something there!!
If anyone has any resources or input please let me know!
Update: I have ran innodb recovery in my.conf file from 1 to 5 and it refused to start. Running initialize also gave me the following errors.
2022-08-03T21:00:31.755720Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
That data path /var/lib/mysql/ holds my current data so i don't want to remove it.