Quantcast How to fix ERROR 2002 (HY000): Can't connect to local MySQL server through socket - digitalFAQ.com Support Forum
Go Back   digitalFAQ.com Support Forum > Digital Publishing / Web Design > Web/Print Publishing Technology

Reply
LinkBack Thread Tools
  #1  
01-16-2012, 09:09 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff / Owner and Editor
 
Join Date: Oct 2009
Posts: 1,306
Thanks: 84
Thanked 138 Times in 132 Posts
I always forget to change this setting when attempting to copy/paste somebody else's MySQL config file (my.cnf).

Always locate your original socket setting before overwriting your existing my.cnf
-- or if you're smart, before creating a new my.cnf after renaming the old one. I like to mv the old one to my.cnf.default, just in case.

For example, this is the proper socket for my dev server:
Code:
socket = /var/run/mysqld/mysqld.sock
I've been trying some tweaked variations of the lowendbox.com MySQL for low-RAM (128MB or less) servers:
Code:
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
If I run this my.cnf file, I'll get an Error 2002 on the back end. For example, when trying to access MySQL with the mysql command.

Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Don't see the problem? Look again:
socket = /var/lib/mysql/mysql.sock
socket = /var/run/mysqld/mysqld.sock


Wrong location = MySQL will not start. Oops. --- Don't feel too stupid. I had to Google it, too.

This post, like many others, is a note to self. So much time passes between setting up servers (weeks to months), that I tend to forget some of the easy tasks. In the old days, we kept notebooks. Those were not as easy to search and forums and blogs, however, especially if you power your searches with Google's engine!

If you've come across this post, I hope it's helped you. And welcome to the site.

__________________

Need a good host? .Find one here: List of the Best Web Hosts in 2012 - Shared, reseller and VPS hosting
__________________
- Thanks for visiting! | Advertise on The Digital FAQ | Upgrade to Premium Member
- Please Like Us on Facebook | Follow Us on Twitter
Reply With Quote


Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL query to disable comments on WordPress posts/pages admin Web/Print Publishing Technology 0 10-02-2011 06:07 PM
Advise about buying a used unit from local dealer? rockovids Project Planning, Workflows 1 07-30-2011 05:56 PM
Can I connect my computer to my LCD tv cyber-junkie Home Entertainment and Videography 16 06-09-2011 01:00 PM
How to set up FTP to connect to website servers? admin Web/Print Publishing Technology 5 03-13-2009 01:40 PM
How to use FTP to Connect to a Server lordsmurf Computers 4 07-28-2006 03:39 PM

Thread Tools



 
All times are GMT -5. The time now is 06:27 PM  —  vBulletin Copyright © 2011 Jelsoft Enterprises Ltd  —  SEO by vBSEO