Computing.Net > Forums > Linux > mysql error 2002

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

mysql error 2002

Reply to Message Icon

Name: advancedonsite
Date: December 21, 2002 at 23:55:37 Pacific
OS: redhat 8.0
CPU/Ram: p2-500 256mb Ram
Comment:

i cannot get mysql to start ive been to thier site and tried to reinstall mysql too.
they said make sure the mysql.sock file is present and it is...
heres the only log file i can find


/usr/libexec/mysqld, Version: 3.23.52-log, started with:
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
Time Id Command Argument


also this

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

can anyone help me?



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: December 22, 2002 at 19:09:05 Pacific
Reply:

Does a file exist as
/var/lib/mysql/mysql.sock ?

What does your /etc/my.cnf file look like?

A sample snippet follows:

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# socket = /var/lib/mysql/mysql.sock
# set-variable = local-infile=1

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock


0

Response Number 2
Name: useless1964
Date: December 23, 2002 at 13:01:31 Pacific
Reply:

The mysl.cosk is probably owned by root and the mysql daemon is trying th "call" it

try chown mysql.sock mysqld -daemon


0

Response Number 3
Name: advancedonsite
Date: December 26, 2002 at 08:50:25 Pacific
Reply:

i can't find mysql.sock even reinstalling the rpm doesnt replace it can i recreate it?

heres my cnf file

[root@linuxserver root]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

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


0

Response Number 4
Name: advancedonsite
Date: December 26, 2002 at 08:55:21 Pacific
Reply:

Missing mysql.sock file
Posted By: Mark - Sep 27, 2002 5:58 am
you can use the following C code to recreate your mysql socket. I used this code on a RedHat 7.3 machine.

type the following command at prompt as root

vi file.c

(paste the below stuff %%%%%%%%)

#include
#include

#define SOCKETNAME "/mysql/mysql.sock"

// to compile use: gcc -o exe_name file.c -lnsl

int main(void)
{
int s, len;
struct sockaddr_un name;

unlink(SOCKETNAME);

if((s=socket(AF_UNIX, SOCK_STREAM, 0)) < 0 )
{
perror("socket");
exit(1);
}

memset(&name, 0, sizeof(struct sockaddr_un));

name.sun_family = AF_UNIX;
strcpy(name.sun_path, SOCKETNAME);
len = sizeof(name.sun_family) + strlen(name.sun_path);

if(bind(s, (struct sockaddr *) &name, len) < 0)
{
perror("bind");
exit(1);
}

return 0;
}


(end of paste stuff %%%%%%%%)
without the %%%% lines


0

Response Number 5
Name: advancedonsite
Date: December 27, 2002 at 10:45:44 Pacific
Reply:

ok got the winsock fixed now i need to


[root@linuxserver root]# cat /var/log/mysqld.log
021226 08:17:03 mysqld started
/usr/libexec/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2)
021226 8:17:03 Aborting

021226 8:17:03 /usr/libexec/mysqld: Shutdown Complete

021226 08:17:04 mysqld ended

021226 15:10:39 mysqld started
/usr/libexec/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2)
021226 15:10:39 Aborting

021226 15:10:39 /usr/libexec/mysqld: Shutdown Complete

021226 15:10:39 mysqld ended

interesting?


0

Related Posts

See More



Response Number 6
Name: advancedonsite
Date: December 27, 2002 at 20:16:39 Pacific
Reply:

ok i got it working here's my finding's and long term problems.....

First to recreate a socket mysql does it itself
by typing
service mysqld start
at the command prompt.....

also check
/etc/my.cnf
for settings...here's my settings
-------
[mysqld]
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
-------------
without the dashes

verify the datadir in this file with the
actual directory which mine is
/var/lib/mysql

The my.cnf i originally had said
/var/lib/mysql/mysql
ouch


Here's my log file for /var/log/mysqld.log
use the below command to view yours

cat /var/log/mysqld.log

----------
021227 19:13:29 /usr/libexec/mysqld: Table 'mysql.host' doesn't exist
021227 19:13:29 mysqld ended

021227 19:15:27 mysqld started
021227 19:15:28 /usr/libexec/mysqld: Table 'mysql.host' doesn't exist
021227 19:15:28 mysqld ended

021227 19:18:29 mysqld started
/usr/libexec/mysqld: ready for connections

------------

so it really exists but in fact first i had to create the socket with the first command
then i change my datadir to the correct directory and everything is ok....


0

Sponsored Link
Ads by Google
Reply to Message Icon

Best Linux?? Help!! gentoo installation



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: mysql error 2002

MySQL error 2002 www.computing.net/answers/linux/mysql-error-2002/18909.html

ERROR 2002: Can't connect to local www.computing.net/answers/linux/error-2002-cant-connect-to-local-/26637.html

mySQL error www.computing.net/answers/linux/mysql-error/27519.html