'Cannot get mysql to start in production Ubuntu 20.04

I have spent the entire day trying to get my sql running but I just don't know what I am doing wrong. I have went through most of stackoverflow answers but have not found a thing that works to get my sql running. I ran mysqld and got the following information (which I don't really know how to interpret):

2020-12-18T03:59:57.157351Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2020-12-18T03:59:57.263898Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 210589
2020-12-18T03:59:57.364391Z 0 [Warning] [MY-010091] [Server] Can't create test file /var/lib/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2020-12-18T03:59:57.366492Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-12-18T03:59:57.404650Z 0 [Warning] [MY-010122] [Server] One can only use the --user switch if running as root
2020-12-18T03:59:57.406047Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to '/var/lib/mysql/' (OS errno: 13 - Permission denied)
2020-12-18T03:59:57.407722Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-12-18T03:59:57.442036Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22-0ubuntu0.20.04.3)  (Ubuntu).

I am hosting the application on Digitalocean and it is in production but broken as it cannot see the db. I ran apache2 restart which went fine. I then ran mysql stop, start, restart commands which all gave me the following:

Job for mysql.service failed because a fatal signal was delivered to the control process.
See "systemctl status mysql.service" and "journalctl -xe" for details.

Frustrated and stumped, any help appreciated. Thank you in advance. If I missed anything, I will be happy to edit my question, just let me know. Thanks.

Edit: Restarted server within DigitalOcean and now the application works and I can access mysql.



Solution 1:[1]

Going into DigitalOcean's control panel and re-starting the server, I was able to access the application as well as log into phpmyadmin.

Solution 2:[2]

I ran into the same error:

Job for mysql.service failed because a fatal signal was delivered to the control process.
See "systemctl status mysql.service" and "journalctl -xe" for details.

Tried the solutions listed in this SO post and although reinstalling mysql-server does resolve the issue, it completely erases the data inside the old databases which I need preserved(which I couldn't access because the mysql server was down), so this wasn't a viable solution for me.

Fortunately I had taken a droplet snapshot for my DigitalOcean droplet and restored it. Now I'm able to access the old database data and get the mysql server started as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erik James Robles
Solution 2 flyingfishcattle