LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   error: Can't connect to local MySQL server through socket (https://www.linuxquestions.org/questions/red-hat-31/error-can%27t-connect-to-local-mysql-server-through-socket-207122/)

J0sep 07-19-2004 05:09 PM

error: Can't connect to local MySQL server through socket
 
Hi all, if u please help me on this.
I get this error with mysql server:

mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

Well that file isn't there...dont' know why.
I've installed mysql server within the istallation of red hat 9. And i've updated my distro but still get the same error. I need this service running to test my 'Koha' server.
If u please help me... anything, I need to know how do I get this thing working.

Also the service can start:
# /etc/init.d/mysqld start
Starting MySQL: [ OK ]

but when trying to enter with mysqladmin -u <user> and all the rest, it fails with the error above.

Please help...
Thanks,
Cheers.

jose

osvaldomarques 07-19-2004 06:52 PM

Hi J0sep,
Normally this socket is on "/var/lib/mysql/mysql.sock". You may have some configuration mismatch between the server and the admin. Until you discover the mismatch, you can link it by entering
Code:

ln -s /var/lib/mysql/mysql.sock /tmp
Good luck!

trippccn 07-28-2004 06:34 AM

That actually solved a problem i've been having... could you possibly explain how i would go about finding this mismatch? I hate to leave it as a work around. I'd rather find the source of the problem.

Thanks,
Chad Arimura

osvaldomarques 07-28-2004 01:12 PM

Hi trippccn,

Look at the file "/etc/my.cnf". May be you could find a divergence in the position of this socket. Mine looks as
Code:

mysql.server]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysqladmin]
socket=/var/lib/mysql/mysql.sock

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

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


trippccn 07-28-2004 02:43 PM

Hi osvaldomarques,

My cnf is as follows. I wonder why the socket is set to /var/lib/mysql directory, but the php web application that was calling the db open function was looking for the /tmp/ sock. Could it be something I'm missing when I upgraded from 3.23 to 4.0.20?

Code:

[mysqld]
default-character-set=latin1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-innodb
   
[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Thanks a lot,
Chad

osvaldomarques 07-28-2004 06:14 PM

I don't think so...
Historically all the sockets were open in /tmp, because they can be easily removed during boot up procedures. They don't need to exist when the server is not running. For a matter of security, nowadays, the things historically laid in /tmp are gaining another directories, because /tmp is accessible by all local users. The php server have a configuration, probably at "/etc/php4/apache/php.ini" where you can specify the location of the socket for php access.

helpmeforlinux 09-22-2007 08:13 AM

yum install mysql
 
hi i have installed mysql using command
yum install mysql

My distro is Fedora 6
and it installed it succesfully
but when i try service mysqld start it say unrecognized service.

what will be the problem can any body address in this regards.

osvaldomarques 09-22-2007 10:39 AM

Probably you installed only the client package. There is a package named "mysql-server" which contains the server. For more info about the available packages, use
Code:

yum list available|grep mysql

zyopensource 02-18-2008 09:21 PM

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 
hi i have installed mysql using command
yum install mysql
My distro is Fedora 8
and it installed it succesfully
but when i try service mysqld start it say Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
the Code of /etc/my.cnf is:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

zyopensource 02-19-2008 06:34 AM

I am so happy!
I solve my error questions"Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'",because mysqld isn't run.We can find in "K menu-->setting-->service setting",if only you start mysqld ,you can input this "mysql -u root",then you can see this" mysql>".
But I don't know yours' systems ,my system is fedora 8 and I use "yum install mysql"installing mysql.

falling123 06-27-2008 04:54 PM

This best and quickest fix I've found for this
 
Just restart the mysql service
sudo /sbin/service mysqld restart

that should refresh everything

Brotherred 01-23-2009 11:29 PM

mysql on Mandriva 2008.1
 
Hello all. I am kinda frustrated as I am really looking to get a greeting card suite working. I am thinking that some sort of data base program is how proprietary greeting card programs actually work. That would be the rational behind sticking with this attempt. It does seem that all *nix tech stuff is the base for the more closed API flavors.

I have the some of the same issues discussed in this thread but still am not sure how to handle this. This thread is dated as well.

Code: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

So could I use the advice posted in this thread for my issue. Sorry I am pretty lost as for what to do.

karthiksharu 05-16-2009 05:52 PM

httpd and mysqld difference
 
I got connection error to when tried to connect to mysql using mysql administrator also with 'mysql -u root'. I tried restarting httpd but cant fix it. Again I tried with 'service mysqld restart' and it worked.
Can anyone tell me whats the difference between httpd and mysqld.

Thanks a lottt

TB0ne 05-16-2009 06:13 PM

Quote:

Originally Posted by karthiksharu (Post 3543161)
I got connection error to when tried to connect to mysql using mysql administrator also with 'mysql -u root'. I tried restarting httpd but cant fix it. Again I tried with 'service mysqld restart' and it worked.
Can anyone tell me whats the difference between httpd and mysqld.

Thanks a lottt

Open your own thread, and ask the question. Don't hijack someone elses (old) question...that's very rude.

And you might want to try Google if you need such basic knowledge....

Esswendle 08-07-2009 05:33 PM

Quote:

Originally Posted by TB0ne (Post 3543172)
Open your own thread, and ask the question. Don't hijack someone elses (old) question...that's very rude.

And you might want to try Google if you need such basic knowledge....



I came to this site as I am having a Linux software issue, but seeing this post has really put me off.


This forum describes itself as "friendly" and it's tag-line is "where Linux users come for help".


Really? someone asks a question and get's told he/she is being "rude" (as the question may have been asked in the 'wrong' place) and is advised to bugger off to google as the enquiry is deemed too "basic" to bother helping with?


I think it's clear who is really being rude.



It's quite disgraceful behaviour from someone posting on, supposedly, a help forum.


All times are GMT -5. The time now is 06:13 PM.