Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-06-2007, 11:03 AM   #1
Registered: Jun 2006
Location: Orlando
Distribution: FC3, FC5, CentOS4, Ubuntu 6.06
Posts: 57

Rep: Reputation: 15
Apache 2.2.2/MySQL ??? Error

Okay, MySQL has not been working. I've posted this in one other thread, but since I'm having this apache weirdness as well I figured I'd group them into one question.

Here you can see MySQL just not working. Now that I've got more time I'll see if I can search Splunk for anything related. Any pointers on using Splunk or checking error logs would be greatly appreciated as well!
[root@69-64-69-24 ~]# httpd -v
Server version: Apache/2.2.2
Server built:   Jul 26 2006 11:12:08
[root@69-64-69-24 ~]# mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@69-64-69-24 ~]# php -v
PHP 5.1.6 (cli) (built: Feb 23 2007 10:11:28)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with the ionCube PHP Loader v3.1.16, Copyright (c) 2002-2006, by ionCube Ltd.
[root@69-64-69-24 ~]#
This illustrates my directory structure.
[root@69-64-69-24 www]# pwd
[root@69-64-69-24 www]# ls -lah
total 60K
drwxrwxrwx 4 root root 4.0K Apr  5 13:50 .
drwxrwxrwx 5 root root 4.0K Nov 29 10:40 ..
lrwxrwxrwx 1 root root   26 Mar 23 06:36 ckesler -> /home/ckesler/public_html/
drwxrwxrwx 2 root root 4.0K Nov 29 10:40 css
-rwxrwxrwx 1 root root   24 Mar 15 06:40 googlehostedservice.html
drwxrwxrwx 3 root root 4.0K Nov 29 10:40 img
-rwxrwxrwx 1 root root 3.5K Mar 13 14:28 index.html
-rw-r--r-- 1 root root  35K Apr  5 13:50 index.php
lrwxrwxrwx 1 root root   27 Apr  5 11:38 mcupples -> /home/mcupples/public_html/
lrwxrwxrwx 1 root root   27 Apr  5 11:38 mmongeau -> /home/mmongeau/public_html/
Now, the only problematic thing is that /home/www is not a real directory but a symlink itself. The real directory is /var/www/vhosts/default/htdocs. I don't think there's any issue with that, I just set it up that way so I didn't have to type all that out every time I go there.

I would post my httpd.conf file here but I'm afraid I'll get yelled at. Instead, I just hosted it at It's the index page.

To recap:
* My issue with MySQL is the error "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"
* My issue with Apache is that my settings are incorrect for supporting virtual hosts.


Edit: Also, how can I change the name of my server at the bash prompt? Instead of [root@69-64-69-24 www], I'd like it to say [ www]. No worries about that, though!

Last edited by mcupples; 04-06-2007 at 11:06 AM.
Old 04-08-2007, 09:11 AM   #2
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
Keep in mind that when you type "mysql" at a prompt, you are trying to start the client. If there is no mysql.sock file, chances are that mysqld (the server) is not running. Depending on how it was installed, you should be able to type
/etc/init.d/mysql start
to get it running. Try that and let us know if that resolves the issue.

To change the hostname, type
and then edit /etc/sysconfig/network and make sure there is a line that has
When you change the hostname, make sure that mysql is not running at the time. The reason is that it keeps track of its process ID in a file named <hostname>.pid, and if you change the hostname while it is running, it will look for <new hostname>.pid to shut down or restart.

See if that helps, and then we can address the Apache issue.
Old 04-09-2007, 07:02 AM   #3
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419

Rep: Reputation: 30
httpd.conf looks fine. As long as you have the directories referenced by the virtual host containers, like /home/ckesler/public_html, there shouldn't be an issue. /home/www is a symlink, but the directories like the one above and /home/mcupples/public_html exist, correct? If so, I don't see what the issue is. What kind of error are you getting, and what does the Apache error log say about it?


apache, error, hosts, mysql, socket, virtual

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
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
Starting MySQL OLD Error : imeout error occurred trying to start MySQL Daemon Fr33B5D Linux - Software 9 10-28-2006 07:23 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
Debian + Apache + PHP + = Error critical Linux - Software 4 08-04-2005 05:18 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:40 PM.

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