title: No longer able to connect to MySQL through socket
body: <p>I was trying to do replication and setup my server as slave. i first changed permissions using </p>
  
  <pre><code>sudo chmod 777 /etc/mysql/my.cnf
  </code></pre>
  
  <p>then</p>
  
  <pre><code>sudo chown user:user -R /etc/mysql
  </code></pre>
  
  <p>then i tried installing notepad and it crashed. restarted the server and installed Jedit. Finally I edited the my.cnf file added</p>
  
  <pre><code>server-id=1359126008
  </code></pre>
  
  <p>under <code>[mysqld]</code></p>
  
  <p>after a restart of mysql and then of the server i got this error</p>
  
  <pre><code>Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 
  </code></pre>
  
  <p>now I am not able to connect any longer. Also the <code>mysqld.sock</code> file does not exist in that folder.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>user@ubuntu:~$ sudo service mysql start
  start: Job failed to start
  user@ubuntu:~$ sudo service mysql stop
  stop: Unknown instance: 
  user@ubuntu:~$ sudo service mysql status
  mysql stop/waiting
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>location from my.cnf: <code>log_error = /var/log/mysql/error.log</code></p>
  
  <p>all existing lines in log:</p>
  
  <pre><code>130125 10:38:09 [Note] /usr/sbin/mysqld: Normal shutdown
  
  130125 10:38:09 [Note] Event Scheduler: Purging the queue. 2 events
  130125 10:38:09  InnoDB: Starting shutdown...
  130125 10:38:11  InnoDB: Shutdown completed; log sequence number 7759014
  130125 10:38:11 [Note] /usr/sbin/mysqld: Shutdown complete
  </code></pre>
  
  <p><strong>UPDATE 3</strong>
  nothing related to mysql is running.</p>
  
  <pre><code>user@ubuntu:~$ ps -A
    PID TTY          TIME CMD
      1 ?        00:00:00 init
      2 ?        00:00:00 kthreadd
      3 ?        00:00:00 ksoftirqd/0
      6 ?        00:00:00 migration/0
      7 ?        00:00:00 watchdog/0
      8 ?        00:00:00 migration/1
     10 ?        00:00:00 ksoftirqd/1
     11 ?        00:00:00 watchdog/1
     12 ?        00:00:00 migration/2
     14 ?        00:00:00 ksoftirqd/2
     15 ?        00:00:00 watchdog/2
     16 ?        00:00:00 migration/3
     18 ?        00:00:00 ksoftirqd/3
     19 ?        00:00:00 watchdog/3
     20 ?        00:00:00 cpuset
     21 ?        00:00:00 khelper
     22 ?        00:00:00 kdevtmpfs
     23 ?        00:00:00 netns
     24 ?        00:00:00 kworker/u:1
     25 ?        00:00:00 sync_supers
     26 ?        00:00:00 bdi-default
     27 ?        00:00:00 kintegrityd
     28 ?        00:00:00 kblockd
     29 ?        00:00:00 ata_sff
     30 ?        00:00:00 khubd
     31 ?        00:00:00 md
     32 ?        00:00:00 kworker/0:1
     35 ?        00:00:00 kworker/3:1
     36 ?        00:00:00 khungtaskd
     37 ?        00:00:00 kswapd0
     38 ?        00:00:00 ksmd
     39 ?        00:00:00 khugepaged
     40 ?        00:00:00 fsnotify_mark
     41 ?        00:00:00 ecryptfs-kthrea
     42 ?        00:00:00 crypto
     51 ?        00:00:00 kthrotld
     52 ?        00:00:00 scsi_eh_0
     53 ?        00:00:00 scsi_eh_1
     54 ?        00:00:00 kworker/u:2
     56 ?        00:00:00 binder
     75 ?        00:00:00 deferwq
     76 ?        00:00:00 charger_manager
     77 ?        00:00:00 devfreq_wq
    123 ?        00:00:01 kworker/3:2
    182 ?        00:00:00 scsi_eh_2
    227 ?        00:00:00 kdmflush
    229 ?        00:00:00 kdmflush
    249 ?        00:00:00 jbd2/dm-0-8
    250 ?        00:00:00 ext4-dio-unwrit
    259 ?        00:00:00 scsi_eh_3
    260 ?        00:00:00 usb-storage
    261 ?        00:00:00 scsi_eh_4
    262 ?        00:00:00 usb-storage
    277 ?        00:00:00 flush-252:0
    353 ?        00:00:00 upstart-udev-br
    355 ?        00:00:00 udevd
    453 ?        00:00:00 edac-poller
    487 ?        00:00:00 ttm_swap
    514 ?        00:00:00 kpsmoused
    535 ?        00:00:00 dbus-daemon
    541 ?        00:00:00 rsyslogd
    550 ?        00:00:00 bluetoothd
    581 ?        00:00:00 krfcommd
    592 ?        00:00:00 avahi-daemon
    600 ?        00:00:00 avahi-daemon
    619 ?        00:00:00 cupsd
    696 ?        00:00:00 kvm-irqfd-clean
    699 ?        00:00:01 kworker/2:3
    701 ?        00:00:00 kworker/0:3
    799 ?        00:00:00 upstart-socket-
    957 ?        00:00:00 dhclient
   1024 ?        00:00:00 winbindd
   1035 ?        00:00:00 modem-manager
   1040 ?        00:00:00 winbindd
   1047 ?        00:00:00 NetworkManager
   1058 ?        00:00:00 polkitd
   1098 ?        00:00:00 udevd
   1099 ?        00:00:00 udevd
   1125 tty4     00:00:00 getty
   1133 tty5     00:00:00 getty
   1139 tty2     00:00:00 getty
   1140 tty3     00:00:00 getty
   1144 tty6     00:00:00 getty
   1158 ?        00:00:00 acpid
   1168 ?        00:00:00 atd
   1169 ?        00:00:00 cron
   1174 ?        00:00:00 lightdm
   1175 ?        00:00:00 whoopsie
   1177 ?        00:00:00 irqbalance
   1237 tty7     00:04:31 Xorg
   1437 tty1     00:00:00 getty
   1445 ?        00:00:00 accounts-daemon
   1463 ?        00:00:00 console-kit-dae
   1584 ?        00:00:00 upowerd
   1676 ?        00:00:00 lightdm
   1757 ?        00:00:00 colord
   1844 ?        00:00:00 rtkit-daemon
   1960 ?        00:00:00 gnome-keyring-d
   1971 ?        00:00:00 gnome-session
   2006 ?        00:00:00 ssh-agent
   2009 ?        00:00:00 dbus-launch
   2010 ?        00:00:01 dbus-daemon
   2012 ?        00:00:00 at-spi-bus-laun
   2016 ?        00:00:00 dbus-daemon
   2019 ?        00:00:00 at-spi2-registr
   2033 ?        00:00:01 gnome-settings-
   2038 ?        00:00:00 gvfsd
   2042 ?        00:00:00 gvfsd-fuse
   2062 ?        00:00:00 pulseaudio
   2063 ?        00:00:00 gconf-helper
   2065 ?        00:00:00 gconfd-2
   2067 ?        00:00:00 dconf-service
   2068 ?        00:00:29 nautilus
   2072 ?        00:00:00 polkit-gnome-au
   2073 ?        00:00:00 bluetooth-apple
   2076 ?        00:00:00 nm-applet
   2078 ?        00:00:00 gnome-fallback-
   2090 ?        00:00:00 gvfs-udisks2-vo
   2094 ?        00:00:00 udisksd
   2109 ?        00:00:08 dropbox
   2115 ?        00:00:00 gvfs-afc-volume
   2122 ?        00:00:00 gvfs-gphoto2-vo
   2133 ?        00:00:00 gvfsd-trash
   2146 ?        00:00:00 gvfsd-burn
   2163 ?        00:00:01 bamfdaemon
   2178 ?        00:00:00 notify-osd
   2206 ?        00:00:00 sh
   2207 ?        00:00:01 gtk-window-deco
   2218 ?        00:06:56 compiz
   2247 ?        00:00:09 unity-panel-ser
   2249 ?        00:00:06 hud-service
   2260 ?        00:00:00 indicator-sound
   2262 ?        00:00:00 indicator-sessi
   2268 ?        00:00:00 indicator-print
   2273 ?        00:00:00 indicator-datet
   2275 ?        00:00:00 indicator-appli
   2277 ?        00:00:00 indicator-messa
   2304 ?        00:00:00 evolution-sourc
   2313 ?        00:00:00 goa-daemon
   2317 ?        00:00:00 geoclue-master
   2330 ?        00:00:00 ubuntu-geoip-pr
   2335 ?        00:00:00 telepathy-indic
   2341 ?        00:00:00 mission-control
   2348 ?        00:00:00 signon-ui
   2351 ?        00:00:00 zeitgeist-datah
   2357 ?        00:00:00 zeitgeist-daemo
   2363 ?        00:00:00 zeitgeist-fts
   2371 ?        00:00:00 cat
   2375 ?        00:00:07 firefox
   2403 ?        00:00:00 unity-webapps-s
   2421 ?        00:00:00 unity-applicati
   2423 ?        00:00:00 unity-files-dae
   2425 ?        00:00:00 unity-gwibber-d
   2427 ?        00:00:00 unity-music-dae
   2429 ?        00:00:00 unity-lens-phot
   2431 ?        00:00:00 unity-shopping-
   2433 ?        00:00:00 unity-lens-vide
   2514 ?        00:00:00 unity-musicstor
   2515 ?        00:00:00 unity-scope-gdo
   2543 ?        00:00:00 unity-scope-vid
   2573 ?        00:00:00 teamviewer
   2578 ?        00:00:00 wrapper
   2604 ?        00:00:38 TeamViewer.exe
   2607 ?        00:00:47 wineserver
   2611 ?        00:00:00 services.exe
   2632 ?        00:00:00 update-notifier
   2643 ?        00:00:00 system-service-
   2654 ?        00:06:38 TeamViewer_Desk
   2679 ?        00:00:00 deja-dup-monito
   2700 ?        00:00:00 gvfsd-metadata
   2825 ?        00:00:03 gnome-terminal
   2834 ?        00:00:00 gnome-pty-helpe
   2835 pts/0    00:00:00 bash
   3629 ?        00:00:00 apache2
   3636 ?        00:00:00 apache2
   3637 ?        00:00:00 apache2
   3638 ?        00:00:00 apache2
   3639 ?        00:00:00 apache2
   3640 ?        00:00:00 apache2
   3641 ?        00:00:00 apache2
   3644 ?        00:00:00 apache2
   3645 ?        00:00:00 apache2
   3646 ?        00:00:00 apache2
   3647 ?        00:00:00 apache2
   4089 ?        00:00:00 kworker/2:0
   4419 ?        00:00:08 java
   4465 ?        00:00:00 kworker/1:0
   4486 ?        00:00:00 kworker/1:2
   4552 ?        00:00:00 kworker/2:1
   4762 pts/0    00:00:00 ps
  </code></pre>
  
  <p><strong>UPDATE 4</strong></p>
  
  <p>I couldn't get it working. Re-installed mysql and now its working. If you are worried about the databases, mysql gave me the option of removing them or keeping them. I kept them, installed mysql, used the same root pass as before and now everything is working!! thanks guys!</p>