Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Cannot start mysql service: Unit mysql.service is masked

Writer Mia Lopez

I am trying to install phpMyAdmin and it complained about not able to connect to MySQL server. It seems that the relevant services are not started but I cannot start it.

Here is the results of some commands I run.

# mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
# service mysql stop
# service mysql start
Failed to start mysql.service: Unit mysql.service is masked.
# service mysqld stop
# service mysqld start
Failed to start mysqld.service: Unit mysqld.service is masked.
# systemctl unmask mysql.service
# service mysql start
Failed to start mysql.service: Unit mysql.service is masked.
# systemctl unmask mysqld.service
# service mysqld start
Failed to start mysqld.service: Unit mysqld.service is masked.

Update:

$ file /lib/systemd/system/mysql.service
/lib/systemd/system/mysql.service: ASCII text
$ file /lib/systemd/system/mysqld.service
/lib/systemd/system/mysqld.service: cannot open `/lib/systemd/system/mysqld.service' (No such file or directory)

Update:

I tried removing /var/lib/mysql and restarting mysql, it failed and told me to read /etc/mysql/FROZEN, which says:

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>.

What does this mean? I have never attempted a downgrade.

2

1 Answer

Problem solved!

I removed /etc/mysql and then it complained about no my.cnf.

I then did a full reinstall (purging "mysql*" and installing them back) and it worked.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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