Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning MySQL
|
BOOK: Beginning MySQL
This is the forum to discuss the Wrox book Beginning MySQL by Robert Sheldon, Geoff Moes; ISBN: 9780764579509
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning 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 19th, 2005, 02:15 AM
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

 Hi,

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:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

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

[mysqld]
socket=/var/lib/mysql/mysql.sock

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

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

Regards
//Vito Salieri

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

Hi Vito,

I'm also new to linux and MySQL. I say new I've been playing with both few quite some time never able to get down to solid work due to various things like life etc. I use Fedora Core 3 and MySQL 5.0.9 beta, and the thing that occured to me is that you might have a quick look at whether or not your system has started MySQL, try the following.

From the Applications menu select:

  System Settings> Server Settings> Services

You need your root password to access this.

Then look to see if mysql is one of the available services, make sure the box is ticked, if it is not do so and then also try starting the service, exit from Service Configuration. Then give it another go, you never know it might help it certainly worked for me.

You might also try the following to start:

  mysql -u root

Good luck!

Jeremy

 
Old July 7th, 2006, 03:08 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm still getting an error when I'm using:

-bash-2.05b$ mysql -u root

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

-bash-2.05b$


Please a little help. Thanks.

 
Old October 31st, 2006, 05:54 PM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I bet mysql isn't running does the following bring anything back?
Code:
$ ps ax | grep mysql
You can start mysql by doing as root (on most linux distros):
Code:
# /etc/init.d/mysql start
Look out for any errors and try the ps ax again - you should see mysql chugging along. if not you probably have a config problem. You'll need to locate a file called my.cnf (most likely in /etc/mysql or somewhere). As root do:

Code:
# updatedb && locate my.cnf
This could take a while. Post your my.cnf and someone will probably be able to figure out any config errors.

Cheers,
Charlie

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com





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 MySQL 2 September 14th, 2005 03:06 PM
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.