Mysql Server Not Starting Ubuntu 20.04.3

I have been trying to install the mysql-server on my ubuntu server, but it just gives me this error when I type:

mysql

This is what I get:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

If I check if it is on or not with:

sudo systemctl status mysql

I get:

    ● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2022-04-16 23:29:16 UTC; 5min ago
    Process: 474306 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited,         status=1/FAILURE)

Apr 16 23:29:16 amir-server systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Apr 16 23:29:16 amir-server systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 16 23:29:16 amir-server systemd[1]: Failed to start MySQL Community Server.
Apr 16 23:29:16 amir-server systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Apr 16 23:29:16 amir-server systemd[1]: Stopped MySQL Community Server.
Apr 16 23:29:16 amir-server systemd[1]: mysql.service: Start request repeated too quickly.
Apr 16 23:29:16 amir-server systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 16 23:29:16 amir-server systemd[1]: Failed to start MySQL Community Server.

journalctl -xe gives me:

Apr 16 23:38:54 amir-server systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: 
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 2666039 and the job result is failed.

I have tried reinstalling, no luck. What's funny is that the mysql server works on my other linux machine, but I need it to work on this one :(

Any help is greatly appreciated!

[Edit]

pgrep -l mysql

does not return any processes

/var/log/mysql/error.log

does not exist.

And if I do mysqld it gives me:

mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-04-17T18:30:29.693043Z 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
2022-04-17T18:30:29.710554Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 29346
2022-04-17T18:30:29.976620Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-04-17T18:30:30.038737Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.28-0ubuntu0.20.04.3)  (Ubuntu).

I did what @NioMarvin83 suggested. While installing, I got this:

MySQL has been frozen to prevent damage to your system. Please see /etc/mysql/FROZEN for help.

This is what's inside /etc/mysql/FROZEN:

This MySQL or variant installation has entered "frozen mode". Maintainer
scripts will avoid making changes or starting the daemon until manually
released from this state. See /usr/share/doc/mysql-common/README for
general information about this mode.

In this particular case, an incompatible downgrade attempt has been
detected. This can be resolved in one of two ways:

1. Change the contents of /var/lib/mysql/ to contain database data that
is compatible with the currently installed MySQL or variant daemon
version. For example: you could restore from a backup. Alternatively you
could do a dump using a future version binary and then a restore using
the current version binary.

2. Switch to a MySQL or variant daemon version that is compatible with
the data currently in /var/lib/mysql/. For example, if you have
attempted a downgrade from mysql-server-5.7 to mysql-server-5.6, you
could "apt install mysql-server-5.7" again.

Please resolve this situation and only then remove the /etc/mysql/FROZEN
symlink. You can then run "dpkg-reconfigure <package>" where <package>
should usually be in the form <variant>-server-<version>.
9

1 Answer

I had a similar problem. After many attempts, which ended only in my disappointment. However, the only thing I did before that was to install mysql-server with the command: sudo apt-get install mysql-server I was trying to install and reinstall, upgrade and upgrade ubuntu, although I wasn't sure for my auto xloo part that it would help.

After many attempts and a lot of time it helped me - I fixed, "cleaning" each file associated with mysql, and reinstalling mysql-server: sudo apt-get purge mysql-server mysql-client mysql-common sudo apt-get install mysql-server

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest