php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10763 MySQL Connection Failed: Can't connect to local MySQL server through socket
Submitted: 2001-05-09 15:34 UTC Modified: 2001-05-09 15:42 UTC
From: iandbigejunk at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: Red Hat 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: iandbigejunk at yahoo dot com
New email:
PHP Version: OS:

 

 [2001-05-09 15:34 UTC] iandbigejunk at yahoo dot com
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /var/www/html/test.php on line 4
Could not connect
Problem: mysql sever not talking to php
Solution: Edit /etc/my.cnf to point to /var/lib/mysql/mysql.sock
note you may need to create the directory in /var/lib
also Important to change the ownership of the mysql directory using chmod -0777
Here is a listing of the way the directory should look.
---------------------
[root@hobbes mysql]# ls /var/lib/mysql  
mysql.sock
----------------------
note mysql.sock should be pink! 

here is part of the mysql conf file which should be modified to handle correct volume of traffic.
---------------
# The following options will be passed to all MySQL clients
[client]
#password	= your_password
port		= 3306
socket		= /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port		= 3306
socket		= /var/lib/mysql/mysql.sock
skip-locking
set-variable	= key_buffer=16M
set-variable	= max_allowed_packet=1M
set-variable	= table_cache=64
set-variable	= sort_buffer=512K
set-variable	= net_buffer_length=8K
set-variable	= myisam_sort_buffer_size=8M
log-bin
server-id	= 1
user		= mysql
# Point the following paths to different dedicated disks
#tmpdir		= /tmp/		
#log-update 	= /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#set-variable	= bdb_cache_size=4M
#set-variable	= bdb_max_lock=10000
------------------
Good Luck Hope this Helps!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-09 15:41 UTC] cardinal@php.net
Not a bug.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Feb 03 10:03:43 2023 UTC