2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock (2)

poops

Member
May 6, 2006
23
0
151
Those who face error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
it is not the error bcoz when mysql deamon starts it 1st checks the /tmp/mysql.sock
if /tmp permission changes to other than 777 then the above error comes
i've faced the same error
when i checked /var/lib/mysql/ for mysql.sock it didn't found there it never happens when it is not found but if not found then try to create uor self command is

cd /var/lib/mysql
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 1777 mysql.sock

now make a sym link into /tmp

ln -s /var/lib/mysql/mysql.sock /tmp
then
chmod 1777 /tmp

now
/scripts/mysqlup --force


now just restart mysql
/etc/rc.d/init.d/mysql restart

----------------------------------------------------------:D
in the end would like to thanx Mr Sheakhar
 

k1k

Active Member
Mar 24, 2006
27
0
151
:)

The sockets are create from the mysql service. You should remove the files created from you.
Now you have to check your permissions. Here what I can give you as procedure:


1. chown -R mysql.mysql /var/lib/mysql
2. chmod 777 /tmp
3. chmod 777 /var/tmp
4. su mysql
5. killall -s KILL mysqld
6. mysqld

Now you will see the Mysql Service starting process. If it is successfull then you can restart it as root(/etc/init.d/mysql restart or /scripts/restartsrv_mysql).
 

djblamire

Well-Known Member
May 3, 2003
255
1
168
k1k said:
The sockets are create from the mysql service. You should remove the files created from you.
Now you have to check your permissions. Here what I can give you as procedure:


1. chown -R mysql.mysql /var/lib/mysql
2. chmod 777 /tmp
3. chmod 777 /var/tmp
4. su mysql
5. killall -s KILL mysqld
6. mysqld

Now you will see the Mysql Service starting process. If it is successfull then you can restart it as root(/etc/init.d/mysql restart or /scripts/restartsrv_mysql).
OK, Doing this did seem to work when I started 'mysqld' as 'mysql'. Although I got the error:

bash-3.00$ mysqld
060524 8:18:36 InnoDB: Started
060524 8:18:36 mysqld: Can't open file: 'columns_priv.MYI'. (errno: 130)
mysqld: ready for connections.
Version: '4.0.26-standard' socket: '/var/lib/mysql/mysql.sock' port: 3306 Official MySQL RPM

When I logged back in as root and tried to restart, that stopped it working again.

Any ideas ?

Thanks
Daniel
 

OleOldhoj

Member
May 24, 2006
5
0
151
"help!"

Ok


have the same problem - all sites gives the fault that they cant connect to the database

I when I look in their cpanel - I can see no mySQL database
I have updatet the "Main >> Software >> Apache Update"

but dont have any idea that else to do "HELP!"
 

monsterhosting

Active Member
Feb 12, 2004
39
0
156
Vancouver, BC
You need to go to tweak settings choose MySQL 4.1, check off 4.0 old passwords so that all your scripts don't stop working and click done.

Login in to SSH as root and do:

/scripts/mysqlup --force

Once it is done clean up by doing a:

/etc/init.d/mysql restart
/etc/init.d/cpanel restart
/etc/init.d/chkservd restart
 

OleOldhoj

Member
May 24, 2006
5
0
151
Tried that

and gets a fault -

Adding new fields used by MySQL 4.0.2 to the privilege tables
You can ignore any Duplicate column errors
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
Waiting for mysql to restart..............finished.


/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").
/usr/sbin/setfiles: labeling files under /

--------------------
and
--------------------


/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").
/usr/sbin/setfiles: labeling files under /
matchpathcon_filespec_eval: hash table stats: 1 elements, 1/65536 buckets used, longest chain length 1
/usr/sbin/setfiles: Done.
Install Complete
[email protected] [/var/lib/mysql/mysql]#

-----
and again i dont have MYQSL databases on the accounts

they show

Addon Domains 0 / 2048
MySQL Databases / 2048 <------
Postgresql Databases 1 / 2048

---- bye the way

[email protected] [/var/lib/mysql/mysql]# cat /etc/my.cnf
cat: /etc/my.cnf: No such file or directory
[email protected] [/var/lib/mysql/mysql]#


I dont have a my.cnf


You are welcome to contact me on MSN ([email protected] ) or ICQ 144798790
I really need a soloution
 
Last edited:

djblamire

Well-Known Member
May 3, 2003
255
1
168
monsterhosting said:
You need to go to tweak settings choose MySQL 4.1, check off 4.0 old passwords so that all your scripts don't stop working and click done.

Login in to SSH as root and do:

/scripts/mysqlup --force

Once it is done clean up by doing a:

/etc/init.d/mysql restart
/etc/init.d/cpanel restart
/etc/init.d/chkservd restart
This worked for me!!

Thank you VERY much,

Daniel
 

hamper

Well-Known Member
Apr 28, 2006
85
0
156
mine is doing the exact same thing.

which radio do I use, the top or middle? and yes, I have the box checked to keep the passwords the same.
 

kdarray

Well-Known Member
Apr 13, 2006
81
0
156
Washington
cannot get sql to restart-all sites down

i have been through the forum and tried most of the options people have mentioned. the server is WHM 10.8.0 cPanel 10.8.1-S114, Fedora i686 - WHM X v3.1.0 (Fedora 4) and mysql v.4.0.25. mysql stopped after upcp ran this morning, though i can't see that it changed anything.

i can't get into phpadmin either. getting wrong username and password error. so this and no mysql.

i have tried these and know there have been numerous problems with this in the past week. my servers are set to manual updates

1. chown -R mysql.mysql /var/lib/mysql
2. chmod 777 /tmp
3. chmod 777 /var/tmp
4. su mysql
5. killall -s KILL mysqld
6. mysqld

and this:
cd /var/lib/mysql
touch mysql.sock
chown mysql:mysql mysql.sock
chmod 1777 mysql.sock

ln -s /var/lib/mysql/mysql.sock /tmp
then
chmod 1777 /tmp

/scripts/mysqlup --force

/etc/rc.d/init.d/mysql restart

still getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). mysql.sock just disappears right after chmod or creating the symlink.

also myphpadmin i get wrong username and password, though it is correct in my.cnf and i have changed the root password and tried that as well.

cannot get mysql to restart and urgently need help. all sites on this server are down and not a pleasant sunday morning here.
 

Saloni

Active Member
May 26, 2006
27
0
151
Please check the permission for /tmp folder

It should be chmod'ed to 1777
 

Johnpg82

Member
Jul 3, 2005
9
0
151
I am having the same problem and I have tried everything in this thread. The mysql.sock was not there before and is now there but it still says

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysq l.sock' (111)

Thanks, John.
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,221
4
193
Minneapolis, MN
Johnpg82 said:
I am having the same problem and I have tried everything in this thread. The mysql.sock was not there before and is now there but it still says

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysq l.sock' (111)
Are you sure MySQL is installed properly on your server? If you tried every thing in this thread and didn't work, I suggest you seek professional help.