LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-25-2003, 08:29 PM   #1
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Rep: Reputation: 30
MySQL


I'm trying to get mysql all happy on a server that will be running php and apache.

Anyway, I know the server is running because is in the process list. Also, when I do this:

# mysqladmin -h 127.0.0.1 --port=3306 version

I get a good response. However, I don't want to have all that junk on EVERY query. Here's what I get when I do it the "normal way:

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

Well, anyway, I realy don't know what unix sockets really are...

So, could somebody enlighten me?
 
Old 11-25-2003, 09:13 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
man 2 socket
man 7 socket

A socket is a means of communication,
sometimes over a network, sometimes through
a local device that manifests itself in the
filesystem....

Having said that, do what it said, check
for the existence (and permissions).

Cheers,
Tink
 
Old 11-25-2003, 10:18 PM   #3
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
It doesn't exist.... what should I do?

Also, while we're at it, what's the difference between the man numbers?
 
Old 11-26-2003, 04:24 PM   #4
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
^^
 
Old 11-26-2003, 04:51 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Ummm ... I don't use MySQL (even though
Slack has a package for it), so won't be able
to give you too much info. How did you install
it? Slack-pack or Source? If source, does it
require you to create a specific user for the
daemon? And if it did, have you made the
directory it was saying owned by that user?



Cheers,
Tink (off to download firebird :})
 
Old 11-27-2003, 04:12 PM   #6
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
I compiled from source, and slack already had the mysql user and group. I can get the database running, so I know it works. I just want the sock file to work properly so that I don't have to modify all my sql based progs.
 
Old 11-27-2003, 04:31 PM   #7
Sonderblade
LQ Newbie
 
Registered: May 2003
Posts: 22

Rep: Reputation: 15
The MySQL daemon is most likely not running. Type "safe_mysqld &" to start it.
 
Old 11-27-2003, 04:45 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
... have you made the directory it was
saying owned by that user?
It = the error message referring to the socket.

Cheers,
Tink
 
Old 11-27-2003, 06:50 PM   #9
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
@sonderblade - I know its running. ps tells me it is running, nmap tells me it is running, and here's a quote of myself telling you that it is running:
Quote:
# mysqladmin -h 127.0.0.1 --port=3306 version

I get a good response.
@tinkster - yes, it is made and owned by the proper user.
 
Old 11-27-2003, 10:12 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
And what are the permissions? :)


Cheers,
Tink
 
Old 11-27-2003, 10:49 PM   #11
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
mysql is owner, under mysql group. owner and group have r/w permissions. Others have r.
 
Old 11-27-2003, 10:55 PM   #12
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
yeah, I gave it full perms to see what happened.

Code:
root@server:/var/run/mysql# ls -al
total 1
drwxr-xr-x    2 root     root           80 Nov 27 22:22 ./
drwxr-xr-x    7 root     root          464 Nov 25 20:26 ../
-rwxrwxrwx    1 mysql    mysql           0 Nov 27 22:22 mysql.sock*
root@server:/var/run/mysql# mysqladmin version
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!

Also, to prove its running:

Code:
root@server:/var/run/mysql# ps -aux
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   480   64 ?        S    Nov25   0:06 init [3]
root         2  0.0  0.0     0    0 ?        SW   Nov25   0:00 [keventd]
root         3  0.0  0.0     0    0 ?        SW   Nov25   0:00 [kapmd]
root         4  0.0  0.0     0    0 ?        SWN  Nov25   0:00 [ksoftirqd_CPU0]
root         5  0.0  0.0     0    0 ?        SW   Nov25   0:02 [kswapd]
root         6  0.0  0.0     0    0 ?        SW   Nov25   0:00 [bdflush]
root         7  0.0  0.0     0    0 ?        SW   Nov25   0:01 [kupdated]
root         9  0.0  0.0     0    0 ?        SW   Nov25   0:00 [khubd]
root        12  0.0  0.0     0    0 ?        SW   Nov25   0:00 [kreiserfsd]
rpc        202  0.0  0.4  1512  248 ?        S    Nov25   0:00 /sbin/rpc.portmap
root       208  0.0  0.5  1424  324 ?        S    Nov25   0:00 /usr/sbin/syslogd
root       211  0.0  0.3  1360  208 ?        S    Nov25   0:00 /usr/sbin/klogd -c 3 -x
root       213  0.0  0.3  1396  204 ?        S    Nov25   0:00 /usr/sbin/inetd
root       216  0.0  0.7  3044  452 ?        S    Nov25   0:01 /usr/sbin/sshd
lp         224  0.0  0.3  3348  236 ?        S    Nov25   0:00 lpd Waiting
root       227  0.0  0.6  1484  400 ?        S    Nov25   0:00 /usr/sbin/crond -l10
daemon     229  0.0  0.4  1488  292 ?        S    Nov25   0:00 /usr/sbin/atd -b 15 -l 1
root       234  0.0  0.4  1356  276 ?        S    Nov25   0:00 /usr/sbin/apmd
root       237  0.0  0.5  6148  320 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     239  0.0  1.8  6256 1132 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     240  0.0  1.8  6248 1136 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     241  0.0  4.2  6420 2620 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     242  0.0  2.2  6252 1364 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     243  0.0  3.1  6268 1952 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
root       244  0.0  0.4  5048  284 ?        S    Nov25   0:00 /usr/sbin/smbd -D
root       246  0.0  1.1  3940  688 ?        S    Nov25   0:00 /usr/sbin/nmbd -D
root       248  0.0  0.6  3892  388 ?        S    Nov25   0:00 /usr/sbin/nmbd -D
root       249  0.0  0.0  1404   48 ttyS0    S    Nov25   0:00 /usr/sbin/gpm -m /dev/mouse -t bare
root       253  0.0  0.3  1356  192 tty1     S    Nov25   0:00 /sbin/agetty 38400 tty1 linux
root       254  0.0  0.3  1356  192 tty2     S    Nov25   0:00 /sbin/agetty 38400 tty2 linux
root       255  0.0  0.3  1356  192 tty3     S    Nov25   0:00 /sbin/agetty 38400 tty3 linux
root       256  0.0  0.3  1356  192 tty4     S    Nov25   0:00 /sbin/agetty 38400 tty4 linux
root       257  0.0  0.3  1356  192 tty5     S    Nov25   0:00 /sbin/agetty 38400 tty5 linux
root       258  0.0  0.3  1356  192 tty6     S    Nov25   0:00 /sbin/agetty 38400 tty6 linux
nobody     285  0.0  3.1  6764 1976 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     290  0.0  4.4  6772 2736 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     337  0.0  4.0  6772 2488 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     344  0.0  1.7  6240 1092 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
nobody     345  0.0  1.4  7296  892 ?        S    Nov25   0:00 /usr/local/apache/bin/httpd
root      1960  0.0  1.9  5660 1236 ?        S    22:26   0:00 /usr/sbin/sshd
root      1962  0.0  2.1  2292 1336 pts/1    S    22:27   0:00 -bash
root      2038  0.0  1.6  2048 1016 pts/1    S    22:53   0:00 bash /usr/local/mysql/bin/mysqld_safe
mysql     2055  0.6 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2057  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2058  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2059  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2060  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2061  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2062  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2063  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2064  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
mysql     2065  0.0 19.5 46176 12064 pts/1   S    22:53   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/loc
root      2074  0.0  1.3  2660  812 pts/1    R    22:55   0:00 ps -aux

Last edited by kleptophobiac; 11-27-2003 at 10:58 PM.
 
Old 11-27-2003, 11:26 PM   #13
lynger
Member
 
Registered: Nov 2003
Posts: 36

Rep: Reputation: 15
hi

if you'll be running the server with php.. don't forget to install the php-mysql package..

cheers
 
Old 11-28-2003, 01:27 AM   #14
BaenSidhe
LQ Newbie
 
Registered: Nov 2003
Posts: 6

Rep: Reputation: 0
I had a similar problem yesterday after I finally got mysql running. The way I fixed it was to kill all mysql processes and then restart mysql. You can try using shutdown first, but shutdown didn't work for me because at some point after mysql started running, the mysql.sock and pid file disappeared.

Also, when you have php and apache installed, you're going to probably need the php-mysql package that lynger mentioned. Otherwise, php will not be able to connect to the server. If you want to check if you actually need to install the package or if it's already in there, create a page that does phpinfo(). Scroll down and search for a table specifically for mysql. If it's not there, you need the package.

Also, here's some code you can use to see if php and mysql can talk to each other.

[code]
<?php
$db = mysql_connect('localhost', 'baen', 'Ir1sgo9d');
if ($db) echo "Connected, everything is fine.";
else echo "Not connected, but php-mysql module correctly installed.";
?>
[code]
 
Old 11-28-2003, 12:18 PM   #15
kleptophobiac
Member
 
Registered: Jun 2003
Distribution: Arch
Posts: 315

Original Poster
Rep: Reputation: 30
I've restarted mysql, but to no avail.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-08-2008 12:48 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 11:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration