Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 18th, 2005, 05:20 PM
Registered User
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't connect to local MySQL server through socket


I bought Beginning MySQL, Beginning PHP5 and I'm eager to start building dynamic websites, but I can't get MySQL to work on my Fedora Core 4 system.

I get the following messages:

[root@c-280be253 bin]# mysqladmin versions
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!
[root@c-280be253 bin]#

[root@c-280be253 bin]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@c-280be253 bin]#

[root@c-280be253 bin]# mysqld_safe &
[1] 21511
[root@c-280be253 bin]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
050719 00:08:53 mysqld ended

My my.cnf look like this:

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).




I can't locate the mysql.sock and I can't start mysql? What to do???

//Vito Salieri

Old July 23rd, 2005, 11:57 AM
Registered User
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Vito,

(this is the second attempt at a reply)

I am also new to linux and MySQL, I say new I've been playing around with both for some time but not able to set aside enough time to make solid progress. I use Fedora Core 3 and MySQL 5.0.9 beta. However, one thing that occured to me that might be worth trying is the following.

From the applications menu select:

  System Settings>Server Settings>Services

You will need your root password to access this.

Then check to see if mysql is one of the available services, if so make sure the box is ticked, if not do so. Then try starting the service, quit. Then try accessing MySQL from the terminal again. You might also try by using:

  mysql -u root

This certainly worked for me. If however, you don't find the service mysql I suspect that it's not properly installed.

Good luck!


Old September 14th, 2005, 03:06 PM
Authorized User
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths

check that the file /var/lib/mysql/mysql.sock actually exists ... you should *see* it in the file system. also, if you downloaded and instaleld mysqld yourself it might be somewhere else, like /usr/local/var for example. If the file's there, try shutting down the server and if the file hangs around, rm it and restart the server. Also make sure that the user who mysql is running as has write permission to that directory.

If none of the above helps you, check out the message file ... probably /var/log/message, or /var/adm/message (i dont use fedora, but it's usually around there somewhere). mysqld is probably logging a more verbose/descriptive error message there..

Meredith Shaebanyan

Similar Threads
Thread Thread Starter Forum Replies Last Post
couldn't connect to mysql thru socket-help me annumol MySQL 1 May 13th, 2008 08:58 AM
Can't connect to mySql server using localhost RobinR MySQL 3 January 30th, 2006 10:07 PM
Can't connect to SQL server 2000 in local PC shalim SQL Server 2000 1 November 24th, 2005 01:09 AM
Can't connect to local MySQL server through socket Salieri BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 July 19th, 2005 02:18 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.