Thursday, May 14, 2015

Failed to restart mysql.service: Unit mysql.service is masked

On starting the upgrade of Openstack to Kilo, I had a problem starting the mysql/MariaDB as I kept getting an error as follows:

root@ts036953:/home/pssuser# service mysql restart
Failed to restart mysql.service: Unit mysql.service is masked.


Solution:

root@ts036953:/home/pssuser# rm -r /var/lib/mysql*        # Remove any old database setup
root@ts036953:/home/pssuser# mysql_install_db -u mysql    # Install new database
root@ts036953:/home/pssuser# systemctl unmask mysql.service    # Emables the service for systemd
root@ts036953:/home/pssuser# service mysql start        # start the service.

10 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Apparently, MySQL 5.7 deprecates mysql_install_db and suggests to use instead:

    mysqld --initialize

    It's supposed to do the same thing...

    ReplyDelete
  3. unmask command solved my problem, thank you

    ReplyDelete
  4. root@ts036953:/home/pssuser# mysql_install_db -u mysql # Install new database

    having error

    2017-03-19 04:56:43 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
    2017-03-19 04:56:43 [ERROR] The data directory needs to be specified.

    ReplyDelete
  5. Unable to Start MySQL? Contact to MySQL Remote Support and get Best Help
    In most of the cases what we have seen that, users are not able to start their MySQL and suddenly they get some error messages like “Start job failed to start”. They do not understand why this problem has been occurring. If you have the same issue, then first of all you have to check that, if your disk is full then your MySQL cannot start. Sometime this problem occurring only when if you made some changes in your log files. Quickly try these steps to get rid of your all problem otherwise contact to MySQL Technical Support or MySQL Remote Service for rapid solution.
    For More Info: https://cognegicsystems.com/
    Contact Number: 1-800-450-8670
    Email Address- info@cognegicsystems.com
    Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801

    ReplyDelete
  6. sudo systemctl unmask mysql.service

    ReplyDelete