18

I upgraded my ubuntu from ubuntu 18.04 to ubuntu 20.04. On running my MySQL via the terminal, I am not able to access my DBS on running the command

 service MySQL start

I get the error message

Unit mysql.service is masked.
stanley mbote
  • 956
  • 1
  • 7
  • 17
  • 1
    Does this answer your question? [Failed to start redis.service: Unit redis-server.service is masked](https://stackoverflow.com/questions/40317106/failed-to-start-redis-service-unit-redis-server-service-is-masked) – miken32 Dec 01 '20 at 17:08
  • 1
    In addition to being a duplicate, this is a question about server administration, not programming. – miken32 Dec 01 '20 at 17:11

2 Answers2

21

If you are receiving the error message

MySQL services are masked

I simply solved mine by running the below code

systemctl unmask mysql.service

Then restart your MySQL

service mysql start
stanley mbote
  • 956
  • 1
  • 7
  • 17
  • 7
    Yes but, why was it masked? – Rolf Dec 04 '20 at 10:36
  • 2
    Currently we can say its an upstream error while moving from any version of MySQL lower than MySQL version 8.X – stanley mbote Dec 07 '20 at 11:44
  • 2
    I have used mysql for the better part of my coding experience and I have had a fair deal of issues with it but thanks to the support from the community I have always found work around. – stanley mbote Jun 16 '21 at 16:00
  • 1
    I had in interesting problem, during upgrade, I was asked if I wanted to use the maintainer config version and I said yes. After the update was complete, my database server could not start. I discovered that while previously I had a my.cnf file, in '/etc/mysql/my.cnf' now it was gone and I had mysql.cnf. I copied the mysql.cnf to my.cnf and now my server is up and running – Iruku Kagika Jun 22 '23 at 21:01
0

Simply unmask mysql:

sudo systemctl unmask mysql.service

masked means that it has been disabled or made inaccessible. This prevents the unit from being started or enabled.

Deepanshu Mehta
  • 1,119
  • 12
  • 9