0

I've made a bit of a fool of myself in following the directions in this post:

Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in

I used the first answer (the one with 115 upvotes), but followed the wrong directions. I had /var/mysql/mysql.sock but no /tmp/mysql.sock, and then did the following:

cd /var 
mkdir mysql
cd mysql
ln -s /tmp/mysql.sock mysql.sock

Now when I try to connect to my server I just get Connect Error (0). How do I fix this? Do I have to reinstall something?

Thanks all! :)

Community
  • 1
  • 1
Lugubrious
  • 380
  • 1
  • 3
  • 16

1 Answers1

0

Just found a forum that says the following should work on fedora

touch /var/lib/mysql/mysql.sock
cd /tmp
ln -s /var/lib/mysql/mysql.sock .

Please note the . in the end.

service mysql restart

Thats it.

Dai
  • 141,631
  • 28
  • 261
  • 374
Liam Sorsby
  • 2,912
  • 3
  • 28
  • 51
  • Have you restarted before you try anything? – Liam Sorsby Jul 16 '13 at 22:48
  • Yes. I am running unix on a mac though, so the restart was done through my system preferences panel. – Lugubrious Jul 16 '13 at 22:51
  • Not sure if that's the same. Have you run service MySQL restart in the command line. After that remove the symbolic link that you have created then restart again. Try this if the socket isn't recreated then follow the steps and let me know of any errors – Liam Sorsby Jul 16 '13 at 22:54
  • I told you, I'm running unix. service mysql restart doesn't work for my version of mysql, it is different depending on your operating system. Your directions on restarting are just for fedora. The error (I believe) is in your directions where you told me to undo the link. I think you may have made a mistake, as it will not execute the last line, as I mentioned in my first comment. – Lugubrious Jul 16 '13 at 22:57
  • I have just checked and apparently MySQL.sock should not exist when MySQL is down as this is recreated upon restarting the service so if you unlink the link created and restart it should work – Liam Sorsby Jul 16 '13 at 22:57
  • One second I shall check – Liam Sorsby Jul 16 '13 at 22:58
  • Have you tried the following fix? Replacing your local host on your connection to the IP address. Apparently this works on macs 127.0.0.1:3306. With regards the unlink maybe try unlink /var/mysql/mysql.sock – Liam Sorsby Jul 16 '13 at 23:11