Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql: unrecognized service

I followed the instruction here to install mariadb on WSL after following the steps. and I run this

sudo service mysql start

I got

mysql: unrecognized service

Any idea how to solve this?

like image 706
Fil Avatar asked Jul 11 '19 09:07

Fil


1 Answers

Which Linux distribution are you using on your WSL?

First, try the following:

systemctl {start|stop|restart|status} mysql

OR

service mysql {start|stop|restart|status}

to manage the MySQL service.

The reasons can be the following:

  1. Wrong service name:

    On some Linux distributions, the service is named as mysqld instead of mysql.

    To check: Run chkconfig --list on your WSL and identify the correct service name.

  2. File permission issues:

    Please ensure that the files in /var/lib/mysql have 770 permissions and ownership set to mysql user.

    To fix:

    chmod -R 770 /var/lib/mysql
    chgrp -R mysql /var/lib/mysql
    

    In addition to that, ensure that the /etc/rc.d/init.d/mysqld script has executable permissions to modify mysqld.

    To fix:

    chmod 755 /etc/rc.d/init.d/mysqld
    
  3. Missing/Corrupted MySQL server package:

    Reinstall MySQL!

like image 95
Akshay Anurag Avatar answered Sep 24 '22 01:09

Akshay Anurag