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 8403691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:24:41+00:00 2026-06-09T22:24:41+00:00

My problem started off with me not being able to log in as root

  • 0

My problem started off with me not being able to log in as root any more on my mysql install. I was attempting to run mysql without passwords turned on… but whenever I ran the command

# mysqld_safe --skip-grant-tables &

I would never get the prompt back. I was trying to follow these instructions to recover the password.

The screen just looks like this:

root@jj-SFF-PC:/usr/bin# mysqld_safe --skip-grant-tables
120816 11:40:53 mysqld_safe Logging to syslog.
120816 11:40:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

and I don’t get a prompt to start typing the SQL commands to reset the password.

When I kill it by pressing CTRL + C, I get the following message:

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

Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

If I retry the command and leave it long enough, I do get the following series of messages:

root@jj-SFF-PC:/run/mysqld# 120816 13:15:02 mysqld_safe Logging to syslog.
120816 13:15:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120816 13:16:42 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[1]+  Done                    mysqld_safe --skip-grant-tables
root@jj-SFF-PC:/run/mysqld#

But then if I try to log in as root by doing:

# mysql -u root

I get the following error message:

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

I checked and /var/run/mysqld/mysqld.sock file doesn’t not exist. The folder does, but not the file.

Also, I don’t know if this helps or not, but I ran find / -name mysqld and it came up with:

/var/run/mysqld - folder
/usr/sbin/mysqld - file
/run/mysqld - folder

I don’t know if this is normal or not. But I’m including this info just in case it helps.

I finally decided to uninstall and reinstall mysql.

apt-get remove mysql-server
apt-get remove mysql-client
apt-get remove mysql-common
apt-get remove phpmyadmin

After reinstalling all packages again in the same order as above, during the phpmyadmin install, I got the same error:

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

So I tried again to uninstall/reinstall. This time, after I uninstalled the packages, I also manually renamed all mysql files and directories to mysql.bad in their respective locations.

/var/lib/mysql 
/var/lib/mysql/mysql
/var/log/mysql
/usr/lib/perl5/DBD/mysql
/usr/lib/perl5/auto/DBD/mysql
/usr/lib/mysql
/usr/bin/mysql
/usr/share/mysql
/usr/share/dbconfig-common/internal/mysql
/etc/init.d/mysql
/etc/apparmor.d/abstractions/mysql
/etc/mysql

Then I tried to reinstall mysql-server and mysql-client again. But I’ve noticed that it doesn’t prompt me for a password. Isn’t it supposed to ask for an admin password?

  • 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-09T22:24:42+00:00Added an answer on June 9, 2026 at 10:24 pm

    To find all socket files on your system run:

    sudo find / -type s
    

    My Mysql server system had the socket open at /var/lib/mysql/mysql.sock

    Once you find where the socket is being opened, add or edit the line to your /etc/my.cnf file with the path to the socket file:

    socket=/var/lib/mysql/mysql.sock
    

    Sometimes the system startup script that launched the command line executable specifies a flag --socket=path. This flag could override the my.cnf location, and that would result in a socket not being found where the my.cnf file indicates it should be. Then when you try to run the mysql command line client, it will read my.cnf to find the socket, but it will not find it since it deviates from where the server created one. So, Unless you care where the socket resides, just changing the my.cnf to match should work.

    Then, stop the mysqld process. How you do this will vary by system.

    If you’re super user in the linux system, try one of the following if you don’t know the specific method your Mysql setup uses:

    • service mysqld stop
    • /etc/init.d/mysqld stop
    • mysqladmin -u root -p shutdown
    • Some systems aren’t setup to have an elegant way to stop mysql (or for some reason mysql doesn’t respond) and you can force terminate mysql with either:
      • One step: pkill -9 mysqld
      • Two step (least preferred):
        • Find the process id of mysql with either pgrep mysql or ps aux | grep mysql | grep -v grep
        • Assuming the process id is 4969 terminate with kill -9 4969

    After you do this you might want to look for a pid file in /var/run/mysqld/ and delete it

    Make sure the permissions on your socket is such that whatever user mysqld is running as can read/write to it. An easy test is to open it up to full read/write and see if it still works:

    chmod 777 /var/run/mysqld/mysqld.sock
    

    If that fixes the issue, you can tailor the permissions and ownership of the socket as needed based on your security settings.

    Also, the directory the socket resides in has to be reachable by the user running the mysqld process.

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

Sidebar

Related Questions

I am having a problem with a pretty simply program. We started off with
I'm just getting started developing for Android and I'm running into a weird problem.
I am not looking for any alternative of streaming file contents from database, indeed
First off, I'm not asking how to find the path or use the IO
I'm seeing a problem where a Queue is not backed up however the time
I've been hacking at a problem on and off for several days now that
I'm doing a little rails app for a prototype. I started off using a
I've just started doing some PowerShell scripting, and I'm running into a problem testing
I'm making a site, it's software is based off of the 960gs system. Being
The problem We have a table of duplicate customer numbers: A varchar(16) NOT NULL,

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.