0

I'm new in the community! I would like some help in an issue that is driving me crazy. I forgot my MySQL user and password, so I tried to delete MySQL, but something went wrong and now I can't start over again. I tried many times to use the command "sudo apt-get remove --purge mysql". This apparently works, as it deletes mysql server from my PC. But then, when trying to install MySQL again, this error appears

Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

But when I go to "var/run" no "mysqld" folder exists there, so I don't know what to do! I've tried many of the solutions that appeared in other similar posts, but nothing works to me. Thank you in advance!!

2
  • 1
    For future reference there is a way to regain root login to your MySQL server without data loss if you have forgotten or lost it. It involves temporarily running MySQL with access control disabled, then setting up the new password, then restarting. This of course requires root access on the server. Mar 27, 2017 at 2:49
  • Great, I will take this advice for future :) Mar 27, 2017 at 3:10

1 Answer 1

1

I would check for anything in /var/lib/mysql, this is the data directory for MySQL. From memory, even with purge theres a question whether to delete the data or not.

ls -lad /var/lib/mysql

I would move this directory out of the way if it exists, purge & then try install again.

mv /var/lib/mysql /root
1
  • Didn't work, the folder does not exist. But thanks anyway Mar 27, 2017 at 4:05

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.