Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:27:14+00:00 2026-06-13T21:27:14+00:00

I have been using the LAMP stack on a Ubuntu setup. It has been

  • 0

I have been using the LAMP stack on a Ubuntu setup.

It has been working fine, set up multiple databases everything is going fine, and then suddenly this morning I started getting database errors from the webpage I was using, then trying to access PHPMyAdmin got:

error #2002 Cannot log in to the MySQL server

I go into the bash prompt and try to log-in as the root user see whats up I get a similar error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) 

I checked that the mysql.sock file existed which it does, in the specified path in the error above. Permissions where all good, and owned by mysql. I reset the permissions just in case and still get the same error.

Here is the file as seen from BASH:

srwxrwxrwx 1 mysql mysql 0 Oct 21 05:10 mysqld.sock

I thought I would just restart the service, but get the same error when trying to stop, start or restart the service.

This really baffled me, I am no expert with linux or anything, but don’t understand how this can suddenly happen when I didn’t change any of the config settings, and it was running perfectly fine for the last few months.

I tried restarting Apache, and got the error:

apache2: bad user name ${APACHE_RUN_USER}

I don’t think that is related to the MySQL stuff but thought it could be involved. The Apache error seems to more be with the set-up but knowing my luck being lazy has caused my to overlook simple things that has caused it all to come crashing down.

Any help on how to fix the problem, and more importantly prevent this occurrence the future would be greatly appreciated.

I have tried most things that were returned by a basic Google search, and a look around here. I have not yet tried deleting and recreating the sock file, but most other things so far have not worked.

EDIT:

I just wanted to add that the Apache server is still running fine, nothing wrong there even though I do get the error when trying to stop and restart it. Pages that don’t rely on MySQL still load without issue.

I have also tried killing mysql processes through searching the PIDs and also as suggested below killall mysqld (and also killall mysql just for kicks). No processes found through these attempts.

I don’t know if it is relevant or not, but I can’t open (in vim) or view the mysqld.sock file (permission denied) even when using the superuser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:27:15+00:00Added an answer on June 13, 2026 at 9:27 pm

    Have you tried using

    killall mysqld
    

    to kill the server instead of just ending the service, and then starting the MySQL service?

    Or you could try deleting mysql.sock using

    rm /var/run/mysqld/mysqld.sock
    

    Then you would just need to run the MySQL server again by either starting the service or running

    mysqld
    

    It should create a new /var/run/mysqld/mysqld.sock for itself and all should go well.
    Just a thought: this may have happened because the computer wasn’t powered-off correctly, or perhaps MySQL just got a bit confused.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using CI just fine using the MySQL driver. I want to
Have been using a simple CSS only tooltip. Working Example css: .tip { position:relative;
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I
I have been using some Javascript to create a text field once an certain
I have been using the storyboard to make an application and currently there are
I have been using Matlab 2011b and contourf/contourfm to plot 2D data on a
I have been using the following sort: var query = _cityRepository.GetAll( .OrderBy(item => item.RowKey.Substring(0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.