Jump to content

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


Recommended Posts

Posted

Hi all - getting the following when trying to connect to a Xibo server (it suffered a little during a powercut here.)

 

I've tried looking for that file in the directory but it's not there. In fact, running /# find . -name mysqld.sock finds nothing at all.

 

Anyone got any ideas what to do?

 

Thanks everyone.

Posted

Check its running firstly, then check your my.cnf for:

 

[mysqld]
port        = 3306
socket        = /var/run/mysqld/mysqld.sock

 

It should say where the socket file is, if the file doesnt exist there double check permissions are allowing the file to be created.

  • Thanks 1
Posted
Check its running firstly, then check your my.cnf for:

 

[mysqld]
port        = 3306
socket        = /var/run/mysqld/mysqld.sock

 

It should say where the socket file is, if the file doesnt exist there double check permissions are allowing the file to be created.

Hi - thanks for that! Hmm, weird. Found that location and amended permissions (777-ed it), restarted the server too and the permissions revert. Empty folder. Also changing to 777 and trying to start mysql gives the same error message as above.

 

Urgh? :/

Posted
Does it specify a user or group in the my.cnf?

Does that have chown on the folder where the .sock is being created?

Hi - yes it does, specifies "mysql" as user, which has rwx to and ownership of the folder according to the permissions it keeps resetting itself to.

Posted
I am not that familiar with Xibo tbh and I cant seem to find their info, is it its own distro or are you running it on Debian etc? is it docker?

Hi - no it's an older install, running on Ubuntu 12.04.

Posted (edited)
Hi - no it's an older install, running on Ubuntu 12.04.

Could you possibly run a ls -a in /var/run/ and grab a screenshot of /var/run/ with the reverted changes.

 

Also check the free space using the command df

 

EDIT: These steps may help possibly if it's available for your version of Ubuntu: https://unix.stackexchange.com/questions/196840/how-to-investigate-what-is-modifying-a-directories-permission-on-linux

Edited by ZeroHour
  • Thanks 1
Posted (edited)
Found that location and amended permissions (777-ed it), restarted the server too and the permissions revert. Empty folder. Also changing to 777 and trying to start mysql gives the same error message as above.

 

Re: Permissions... see Filesystem Hierarchy Standard - 5.13 /var/run : Run-time variable data

 

5.13 /var/run : Run-time variable data

 

5.13.1 Purpose

 

This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. Programs may have a subdirectory of /var/run; this is encouraged for programs that use more than one run-time file.[footnote 37]

 

...

 

Footnote37: /var/run should be unwritable for unprivileged users (root or users running daemons);

 

The /var/run/mysqld folder will always be removed and recreated at boot when MySQLd starts by design, and will be recreated with it's designed/intended permissions. You're chasing your tail trying to work your way around that...

 

What's the output of:

 

sudo /etc/init.d/mysql start && sudo /etc/init.d/mysql status

 

...?

 

You can also try firing MySQL in safe mode whilst tailing /var/log/syslog... usually gives more verbosity to any error messages.

 

sudo /usr/bin/mysqld_safe --user=mysql --skip-grant-tables

 

tail -f /var/log/syslog

Edited by Marci
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...