1

I am trying to set up SQL on my VPS which is running Kali (Debian) When I run any of the commands I am getting these errors below:

root@kali:~# sudo service mysql restart
Failed to restart mysql.service: Unit mysql.service not found.

root@kali:~# sudo mysql stop
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

I have tried rebooting the system but I get the same errors. I have tried re-installing the MySQL but I get this error:

root@kali:~# sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mysql-server' has no installation candidate

I have tried to log into the MySQL with my node password and a blank password (since this is a first time access) but I am hit with the same error 2002:

root@kali:~# sudo mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

I am running the VPS on my own network that is port forwarded and is a R-Pi 3 with Kali running on it.

Update: If I list directory inside of my /var/run directory I see this:

root@kali:~# cd /var/run
root@kali:/var/run# ls
NetworkManager     lightdm             openvpn-client   sshd.pid
agetty.reload      lightdm.pid         openvpn-server   sudo
console-setup      lock                pcscd            systemd
crond.pid          log                 postgresql       tmpfiles.d
crond.reboot       mlocate.daily.lock  samba            udev
dbus               motd.dynamic        screen           user
dhclient-eth0.pid  mount               sendsigs.omit.d  utmp
dhclient.eth0.pid  network             shm
initctl            openvpn             sshd
1

This question says mysql should be installed on Kali by default. Unless you deliberately removed it, what are you trying to accomplish exactly?

You are using different methods to manage mysql: (1) obviously don't have a service called "mysql.service", hence you cannot start it. (2) Then you try to stop using sudo mysql stop, obviously you cannot stop it if not started in the first place.

What does sudo mysql start do?

1
  • It is a compact version for R-Pi, when I execute sudo mysql start I get the ERROR 2002
    – Jaquarh
    Mar 16 '19 at 10:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.