Score:0

Cannot start mysql service: Unit mysql.service is masked

cw flag

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.

Artur Meinild avatar
vn flag
Does this answer your question? [systemctl, how to unmask](https://askubuntu.com/questions/804946/systemctl-how-to-unmask)
Shu Shang avatar
cw flag
@ArturMeinild No. I posted the update in the question
Score:1
cw flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.