Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)












9














I have mailserver configure using dovecot+postfix+mysql and it was runnig fine in the server(Ubuntu Server). But during last week it stopped working correctly. It doesn't send email. When I try to telnet localhost smtp I'm connecting successfully but when I do mail from:<steve@example.com> and hit Enter it hangs on, nothing happen.



Having reviewed /var/log/mail.log file I've found out that probably(99%) the problem is on postfix when it is trying to connect to MySQL server. If you see the log file given below you can see that it says Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).



Nov 14 21:54:36 ns1 dovecot: dovecot: Killed with signal 15 (by pid=7731 uid=0 code=kill)
Nov 14 21:54:36 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
Nov 14 21:54:36 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
Nov 14 21:54:44 ns1 postfix/postfix-script[7753]: refreshing the Postfix mail system
Nov 14 21:54:44 ns1 postfix/master[1670]: reload -- version 2.7.0, configuration /etc/postfix
Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
Nov 14 21:54:53 ns1 postfix/master[1670]: warning: process /usr/lib/postfix/trivial-rewrite pid 7759 exit status 1
Nov 14 21:54:53 ns1 postfix/cleanup[7397]: warning: problem talking to service rewrite: Connection reset by peer
Nov 14 21:54:53 ns1 postfix/master[1670]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Nov 14 21:54:53 ns1 postfix/smtpd[7071]: warning: problem talking to service rewrite: Success


I tried netstat -ln | grep mysql and it returns



unix 2 [ ACC ] STREAM LISTENING 5817 /var/run/mysqld/mysqld.sock.



The content of /etc/postfix/mysql-virtual-alias-maps.cf file is here:



user = stevejobs
password = apple
hosts = localhost
dbname = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'


Here I tried to change hosts = 127.0.0.1 but it says warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)



So, I am lost and don't know where else to change in order to solve the problem. Any help would be appreciated highly.



Thank you.



EDIT 1



When I do netstat -na I see that mysql is not bind neither to localhost nor to 127.0.0.1. Could it be the problem also?



bakhtiyor@ns1:~$ netstat -na | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN









share|improve this question





























    9














    I have mailserver configure using dovecot+postfix+mysql and it was runnig fine in the server(Ubuntu Server). But during last week it stopped working correctly. It doesn't send email. When I try to telnet localhost smtp I'm connecting successfully but when I do mail from:<steve@example.com> and hit Enter it hangs on, nothing happen.



    Having reviewed /var/log/mail.log file I've found out that probably(99%) the problem is on postfix when it is trying to connect to MySQL server. If you see the log file given below you can see that it says Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).



    Nov 14 21:54:36 ns1 dovecot: dovecot: Killed with signal 15 (by pid=7731 uid=0 code=kill)
    Nov 14 21:54:36 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
    Nov 14 21:54:36 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
    Nov 14 21:54:44 ns1 postfix/postfix-script[7753]: refreshing the Postfix mail system
    Nov 14 21:54:44 ns1 postfix/master[1670]: reload -- version 2.7.0, configuration /etc/postfix
    Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
    Nov 14 21:54:53 ns1 postfix/master[1670]: warning: process /usr/lib/postfix/trivial-rewrite pid 7759 exit status 1
    Nov 14 21:54:53 ns1 postfix/cleanup[7397]: warning: problem talking to service rewrite: Connection reset by peer
    Nov 14 21:54:53 ns1 postfix/master[1670]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
    Nov 14 21:54:53 ns1 postfix/smtpd[7071]: warning: problem talking to service rewrite: Success


    I tried netstat -ln | grep mysql and it returns



    unix 2 [ ACC ] STREAM LISTENING 5817 /var/run/mysqld/mysqld.sock.



    The content of /etc/postfix/mysql-virtual-alias-maps.cf file is here:



    user = stevejobs
    password = apple
    hosts = localhost
    dbname = mailserver
    query = SELECT destination FROM virtual_aliases WHERE source='%s'


    Here I tried to change hosts = 127.0.0.1 but it says warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)



    So, I am lost and don't know where else to change in order to solve the problem. Any help would be appreciated highly.



    Thank you.



    EDIT 1



    When I do netstat -na I see that mysql is not bind neither to localhost nor to 127.0.0.1. Could it be the problem also?



    bakhtiyor@ns1:~$ netstat -na | grep 3306
    tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN









    share|improve this question



























      9












      9








      9


      1





      I have mailserver configure using dovecot+postfix+mysql and it was runnig fine in the server(Ubuntu Server). But during last week it stopped working correctly. It doesn't send email. When I try to telnet localhost smtp I'm connecting successfully but when I do mail from:<steve@example.com> and hit Enter it hangs on, nothing happen.



      Having reviewed /var/log/mail.log file I've found out that probably(99%) the problem is on postfix when it is trying to connect to MySQL server. If you see the log file given below you can see that it says Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).



      Nov 14 21:54:36 ns1 dovecot: dovecot: Killed with signal 15 (by pid=7731 uid=0 code=kill)
      Nov 14 21:54:36 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
      Nov 14 21:54:36 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
      Nov 14 21:54:44 ns1 postfix/postfix-script[7753]: refreshing the Postfix mail system
      Nov 14 21:54:44 ns1 postfix/master[1670]: reload -- version 2.7.0, configuration /etc/postfix
      Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
      Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
      Nov 14 21:54:53 ns1 postfix/master[1670]: warning: process /usr/lib/postfix/trivial-rewrite pid 7759 exit status 1
      Nov 14 21:54:53 ns1 postfix/cleanup[7397]: warning: problem talking to service rewrite: Connection reset by peer
      Nov 14 21:54:53 ns1 postfix/master[1670]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
      Nov 14 21:54:53 ns1 postfix/smtpd[7071]: warning: problem talking to service rewrite: Success


      I tried netstat -ln | grep mysql and it returns



      unix 2 [ ACC ] STREAM LISTENING 5817 /var/run/mysqld/mysqld.sock.



      The content of /etc/postfix/mysql-virtual-alias-maps.cf file is here:



      user = stevejobs
      password = apple
      hosts = localhost
      dbname = mailserver
      query = SELECT destination FROM virtual_aliases WHERE source='%s'


      Here I tried to change hosts = 127.0.0.1 but it says warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)



      So, I am lost and don't know where else to change in order to solve the problem. Any help would be appreciated highly.



      Thank you.



      EDIT 1



      When I do netstat -na I see that mysql is not bind neither to localhost nor to 127.0.0.1. Could it be the problem also?



      bakhtiyor@ns1:~$ netstat -na | grep 3306
      tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN









      share|improve this question















      I have mailserver configure using dovecot+postfix+mysql and it was runnig fine in the server(Ubuntu Server). But during last week it stopped working correctly. It doesn't send email. When I try to telnet localhost smtp I'm connecting successfully but when I do mail from:<steve@example.com> and hit Enter it hangs on, nothing happen.



      Having reviewed /var/log/mail.log file I've found out that probably(99%) the problem is on postfix when it is trying to connect to MySQL server. If you see the log file given below you can see that it says Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).



      Nov 14 21:54:36 ns1 dovecot: dovecot: Killed with signal 15 (by pid=7731 uid=0 code=kill)
      Nov 14 21:54:36 ns1 dovecot: Dovecot v1.2.9 starting up (core dumps disabled)
      Nov 14 21:54:36 ns1 dovecot: auth-worker(default): mysql: Connected to localhost (mailserver)
      Nov 14 21:54:44 ns1 postfix/postfix-script[7753]: refreshing the Postfix mail system
      Nov 14 21:54:44 ns1 postfix/master[1670]: reload -- version 2.7.0, configuration /etc/postfix
      Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
      Nov 14 21:54:52 ns1 postfix/trivial-rewrite[7759]: fatal: mysql:/etc/postfix/mysql-virtual-alias-maps.cf(0,lock|fold_fix): table lookup problem
      Nov 14 21:54:53 ns1 postfix/master[1670]: warning: process /usr/lib/postfix/trivial-rewrite pid 7759 exit status 1
      Nov 14 21:54:53 ns1 postfix/cleanup[7397]: warning: problem talking to service rewrite: Connection reset by peer
      Nov 14 21:54:53 ns1 postfix/master[1670]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
      Nov 14 21:54:53 ns1 postfix/smtpd[7071]: warning: problem talking to service rewrite: Success


      I tried netstat -ln | grep mysql and it returns



      unix 2 [ ACC ] STREAM LISTENING 5817 /var/run/mysqld/mysqld.sock.



      The content of /etc/postfix/mysql-virtual-alias-maps.cf file is here:



      user = stevejobs
      password = apple
      hosts = localhost
      dbname = mailserver
      query = SELECT destination FROM virtual_aliases WHERE source='%s'


      Here I tried to change hosts = 127.0.0.1 but it says warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (110)



      So, I am lost and don't know where else to change in order to solve the problem. Any help would be appreciated highly.



      Thank you.



      EDIT 1



      When I do netstat -na I see that mysql is not bind neither to localhost nor to 127.0.0.1. Could it be the problem also?



      bakhtiyor@ns1:~$ netstat -na | grep 3306
      tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN






      server mysql postfix dovecot mail-server






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '11 at 18:33

























      asked Nov 14 '11 at 17:30









      Bakhtiyor

      4,344185676




      4,344185676






















          5 Answers
          5






          active

          oldest

          votes


















          6














          It seems very stupid but I have solved the problem. I hadn't noticed that a system administrator somehow blocked 3306 port for all hosts at the firewall, and therefore I couldn't connect to mysql. After removing that restriction I was able to connect to mysql without any problems. Thanks for your suggestions and help.






          share|improve this answer



















          • 1




            How to remove restriction?
            – Green
            Jul 19 '13 at 3:32










          • I want to connect via TCP, not through a socket. How can I do that? Thanks.
            – krisanalfa
            Dec 1 '15 at 9:23










          • Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
            – Sushivam
            Nov 11 '16 at 5:40



















          3














          I had a similar problem. Changing "hosts = localhost" to "hosts = 127.0.0.1" and setting bind-address to the same address fixed it for me (bind-address was set at 0.0.0.0 for some reason)






          share|improve this answer





















          • I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
            – Sean Reifschneider
            Jun 5 '15 at 17:38



















          3














          Have you tried to connect to the Mysql server?



          mysql -u username -p


          Also, you can try change the listen address in /etc/mysql/my.cnf to 127.0.0.1 and restart MySQL



          # /etc/mysql/my.cnf
          bind-address = 127.0.0.1





          share|improve this answer























          • I did all you said and no results
            – Bakhtiyor
            Nov 14 '11 at 19:28










          • i mean i can connect to mysql using mysql -u username -p
            – Bakhtiyor
            Nov 15 '11 at 9:07










          • Should be "my.cnf"
            – jnunn
            Feb 8 '13 at 16:27





















          2














          I was just getting this same error on one of the company computers.



          Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


          I was also getting this error a lot when I tried to run X-windows programs through ssh:



          GConf Error: Failed to contact configuration server; 
          some possible causes are that you need to enable TCP/IP networking for ORBit,
          or you have stale NFS locks due to a system crash


          Turns out I had a root file system that was completely filled up, with no free disk space, so my system couldn't write a lot of necessary files. I was getting all sorts of errors, related to many different programs. (Couldn't log in through GDM, GDM wallpaper went black, gconf lock file errors, etc...)



          All I did was enter this simple command to get rid of over 400 MB worth of files in the root partition that were no longer needed.



          sudo apt-get autoremove


          That gave my root file system the breathing space it needed. Now everything runs great. Guess a 10 GB root directory isn't enough to handle over two years worth of Ubuntu updates.



          If anybody cares, the system has been running Ubuntu 10.04 since it came out. The system updates at least once a week. Today's date is 9-6-2012, so that's almost 2 1/2 years worth of updates.






          share|improve this answer























          • when your problem is space, I also suggest askubuntu.com/questions/17432/…
            – ecoologic
            Jan 20 '13 at 0:42










          • +1 for pointing out space issue -- this solved my problem.
            – yuval
            May 30 '13 at 20:26



















          1














          What finally helped me was purging (not removing!) all the apt-get packages related to mysql except for libmysqlclient16 which was in de-install status (not sure what that is).



          So, just do:



          dpkg --get-selections | grep mysql


          and then:



          sudo apt-get purge <package_name>


          Start from common then go to client and then the server.






          share|improve this answer























          • I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
            – Nephente
            Oct 4 '15 at 16:29










          • THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
            – krisanalfa
            Dec 1 '15 at 9:26










          • how to find the blocked port 3306?
            – Sushivam
            Nov 11 '16 at 5:41











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f79226%2fcant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-sock%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6














          It seems very stupid but I have solved the problem. I hadn't noticed that a system administrator somehow blocked 3306 port for all hosts at the firewall, and therefore I couldn't connect to mysql. After removing that restriction I was able to connect to mysql without any problems. Thanks for your suggestions and help.






          share|improve this answer



















          • 1




            How to remove restriction?
            – Green
            Jul 19 '13 at 3:32










          • I want to connect via TCP, not through a socket. How can I do that? Thanks.
            – krisanalfa
            Dec 1 '15 at 9:23










          • Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
            – Sushivam
            Nov 11 '16 at 5:40
















          6














          It seems very stupid but I have solved the problem. I hadn't noticed that a system administrator somehow blocked 3306 port for all hosts at the firewall, and therefore I couldn't connect to mysql. After removing that restriction I was able to connect to mysql without any problems. Thanks for your suggestions and help.






          share|improve this answer



















          • 1




            How to remove restriction?
            – Green
            Jul 19 '13 at 3:32










          • I want to connect via TCP, not through a socket. How can I do that? Thanks.
            – krisanalfa
            Dec 1 '15 at 9:23










          • Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
            – Sushivam
            Nov 11 '16 at 5:40














          6












          6








          6






          It seems very stupid but I have solved the problem. I hadn't noticed that a system administrator somehow blocked 3306 port for all hosts at the firewall, and therefore I couldn't connect to mysql. After removing that restriction I was able to connect to mysql without any problems. Thanks for your suggestions and help.






          share|improve this answer














          It seems very stupid but I have solved the problem. I hadn't noticed that a system administrator somehow blocked 3306 port for all hosts at the firewall, and therefore I couldn't connect to mysql. After removing that restriction I was able to connect to mysql without any problems. Thanks for your suggestions and help.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 6 '12 at 1:48









          belacqua

          15.7k1472103




          15.7k1472103










          answered Feb 2 '12 at 6:23









          Bakhtiyor

          4,344185676




          4,344185676








          • 1




            How to remove restriction?
            – Green
            Jul 19 '13 at 3:32










          • I want to connect via TCP, not through a socket. How can I do that? Thanks.
            – krisanalfa
            Dec 1 '15 at 9:23










          • Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
            – Sushivam
            Nov 11 '16 at 5:40














          • 1




            How to remove restriction?
            – Green
            Jul 19 '13 at 3:32










          • I want to connect via TCP, not through a socket. How can I do that? Thanks.
            – krisanalfa
            Dec 1 '15 at 9:23










          • Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
            – Sushivam
            Nov 11 '16 at 5:40








          1




          1




          How to remove restriction?
          – Green
          Jul 19 '13 at 3:32




          How to remove restriction?
          – Green
          Jul 19 '13 at 3:32












          I want to connect via TCP, not through a socket. How can I do that? Thanks.
          – krisanalfa
          Dec 1 '15 at 9:23




          I want to connect via TCP, not through a socket. How can I do that? Thanks.
          – krisanalfa
          Dec 1 '15 at 9:23












          Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
          – Sushivam
          Nov 11 '16 at 5:40




          Hi @Green, any solution u got on how to remove the restriction or rather how to find if there is restriction on port 3306?
          – Sushivam
          Nov 11 '16 at 5:40













          3














          I had a similar problem. Changing "hosts = localhost" to "hosts = 127.0.0.1" and setting bind-address to the same address fixed it for me (bind-address was set at 0.0.0.0 for some reason)






          share|improve this answer





















          • I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
            – Sean Reifschneider
            Jun 5 '15 at 17:38
















          3














          I had a similar problem. Changing "hosts = localhost" to "hosts = 127.0.0.1" and setting bind-address to the same address fixed it for me (bind-address was set at 0.0.0.0 for some reason)






          share|improve this answer





















          • I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
            – Sean Reifschneider
            Jun 5 '15 at 17:38














          3












          3








          3






          I had a similar problem. Changing "hosts = localhost" to "hosts = 127.0.0.1" and setting bind-address to the same address fixed it for me (bind-address was set at 0.0.0.0 for some reason)






          share|improve this answer












          I had a similar problem. Changing "hosts = localhost" to "hosts = 127.0.0.1" and setting bind-address to the same address fixed it for me (bind-address was set at 0.0.0.0 for some reason)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 30 '12 at 8:28









          Jussi Timonen

          311




          311












          • I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
            – Sean Reifschneider
            Jun 5 '15 at 17:38


















          • I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
            – Sean Reifschneider
            Jun 5 '15 at 17:38
















          I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
          – Sean Reifschneider
          Jun 5 '15 at 17:38




          I was able to leave bind-address as 0.0.0.0 (which was necessary for the clustering I was doing with galera), and just changed "host=127.0.0.1:3306" to switch it to using TCP. I decided on this instead of bind-mounting the socket into the Postfix chroot as others have done.
          – Sean Reifschneider
          Jun 5 '15 at 17:38











          3














          Have you tried to connect to the Mysql server?



          mysql -u username -p


          Also, you can try change the listen address in /etc/mysql/my.cnf to 127.0.0.1 and restart MySQL



          # /etc/mysql/my.cnf
          bind-address = 127.0.0.1





          share|improve this answer























          • I did all you said and no results
            – Bakhtiyor
            Nov 14 '11 at 19:28










          • i mean i can connect to mysql using mysql -u username -p
            – Bakhtiyor
            Nov 15 '11 at 9:07










          • Should be "my.cnf"
            – jnunn
            Feb 8 '13 at 16:27


















          3














          Have you tried to connect to the Mysql server?



          mysql -u username -p


          Also, you can try change the listen address in /etc/mysql/my.cnf to 127.0.0.1 and restart MySQL



          # /etc/mysql/my.cnf
          bind-address = 127.0.0.1





          share|improve this answer























          • I did all you said and no results
            – Bakhtiyor
            Nov 14 '11 at 19:28










          • i mean i can connect to mysql using mysql -u username -p
            – Bakhtiyor
            Nov 15 '11 at 9:07










          • Should be "my.cnf"
            – jnunn
            Feb 8 '13 at 16:27
















          3












          3








          3






          Have you tried to connect to the Mysql server?



          mysql -u username -p


          Also, you can try change the listen address in /etc/mysql/my.cnf to 127.0.0.1 and restart MySQL



          # /etc/mysql/my.cnf
          bind-address = 127.0.0.1





          share|improve this answer














          Have you tried to connect to the Mysql server?



          mysql -u username -p


          Also, you can try change the listen address in /etc/mysql/my.cnf to 127.0.0.1 and restart MySQL



          # /etc/mysql/my.cnf
          bind-address = 127.0.0.1






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 8 '13 at 18:23

























          answered Nov 14 '11 at 19:26









          Salem

          17.1k65082




          17.1k65082












          • I did all you said and no results
            – Bakhtiyor
            Nov 14 '11 at 19:28










          • i mean i can connect to mysql using mysql -u username -p
            – Bakhtiyor
            Nov 15 '11 at 9:07










          • Should be "my.cnf"
            – jnunn
            Feb 8 '13 at 16:27




















          • I did all you said and no results
            – Bakhtiyor
            Nov 14 '11 at 19:28










          • i mean i can connect to mysql using mysql -u username -p
            – Bakhtiyor
            Nov 15 '11 at 9:07










          • Should be "my.cnf"
            – jnunn
            Feb 8 '13 at 16:27


















          I did all you said and no results
          – Bakhtiyor
          Nov 14 '11 at 19:28




          I did all you said and no results
          – Bakhtiyor
          Nov 14 '11 at 19:28












          i mean i can connect to mysql using mysql -u username -p
          – Bakhtiyor
          Nov 15 '11 at 9:07




          i mean i can connect to mysql using mysql -u username -p
          – Bakhtiyor
          Nov 15 '11 at 9:07












          Should be "my.cnf"
          – jnunn
          Feb 8 '13 at 16:27






          Should be "my.cnf"
          – jnunn
          Feb 8 '13 at 16:27













          2














          I was just getting this same error on one of the company computers.



          Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


          I was also getting this error a lot when I tried to run X-windows programs through ssh:



          GConf Error: Failed to contact configuration server; 
          some possible causes are that you need to enable TCP/IP networking for ORBit,
          or you have stale NFS locks due to a system crash


          Turns out I had a root file system that was completely filled up, with no free disk space, so my system couldn't write a lot of necessary files. I was getting all sorts of errors, related to many different programs. (Couldn't log in through GDM, GDM wallpaper went black, gconf lock file errors, etc...)



          All I did was enter this simple command to get rid of over 400 MB worth of files in the root partition that were no longer needed.



          sudo apt-get autoremove


          That gave my root file system the breathing space it needed. Now everything runs great. Guess a 10 GB root directory isn't enough to handle over two years worth of Ubuntu updates.



          If anybody cares, the system has been running Ubuntu 10.04 since it came out. The system updates at least once a week. Today's date is 9-6-2012, so that's almost 2 1/2 years worth of updates.






          share|improve this answer























          • when your problem is space, I also suggest askubuntu.com/questions/17432/…
            – ecoologic
            Jan 20 '13 at 0:42










          • +1 for pointing out space issue -- this solved my problem.
            – yuval
            May 30 '13 at 20:26
















          2














          I was just getting this same error on one of the company computers.



          Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


          I was also getting this error a lot when I tried to run X-windows programs through ssh:



          GConf Error: Failed to contact configuration server; 
          some possible causes are that you need to enable TCP/IP networking for ORBit,
          or you have stale NFS locks due to a system crash


          Turns out I had a root file system that was completely filled up, with no free disk space, so my system couldn't write a lot of necessary files. I was getting all sorts of errors, related to many different programs. (Couldn't log in through GDM, GDM wallpaper went black, gconf lock file errors, etc...)



          All I did was enter this simple command to get rid of over 400 MB worth of files in the root partition that were no longer needed.



          sudo apt-get autoremove


          That gave my root file system the breathing space it needed. Now everything runs great. Guess a 10 GB root directory isn't enough to handle over two years worth of Ubuntu updates.



          If anybody cares, the system has been running Ubuntu 10.04 since it came out. The system updates at least once a week. Today's date is 9-6-2012, so that's almost 2 1/2 years worth of updates.






          share|improve this answer























          • when your problem is space, I also suggest askubuntu.com/questions/17432/…
            – ecoologic
            Jan 20 '13 at 0:42










          • +1 for pointing out space issue -- this solved my problem.
            – yuval
            May 30 '13 at 20:26














          2












          2








          2






          I was just getting this same error on one of the company computers.



          Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


          I was also getting this error a lot when I tried to run X-windows programs through ssh:



          GConf Error: Failed to contact configuration server; 
          some possible causes are that you need to enable TCP/IP networking for ORBit,
          or you have stale NFS locks due to a system crash


          Turns out I had a root file system that was completely filled up, with no free disk space, so my system couldn't write a lot of necessary files. I was getting all sorts of errors, related to many different programs. (Couldn't log in through GDM, GDM wallpaper went black, gconf lock file errors, etc...)



          All I did was enter this simple command to get rid of over 400 MB worth of files in the root partition that were no longer needed.



          sudo apt-get autoremove


          That gave my root file system the breathing space it needed. Now everything runs great. Guess a 10 GB root directory isn't enough to handle over two years worth of Ubuntu updates.



          If anybody cares, the system has been running Ubuntu 10.04 since it came out. The system updates at least once a week. Today's date is 9-6-2012, so that's almost 2 1/2 years worth of updates.






          share|improve this answer














          I was just getting this same error on one of the company computers.



          Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


          I was also getting this error a lot when I tried to run X-windows programs through ssh:



          GConf Error: Failed to contact configuration server; 
          some possible causes are that you need to enable TCP/IP networking for ORBit,
          or you have stale NFS locks due to a system crash


          Turns out I had a root file system that was completely filled up, with no free disk space, so my system couldn't write a lot of necessary files. I was getting all sorts of errors, related to many different programs. (Couldn't log in through GDM, GDM wallpaper went black, gconf lock file errors, etc...)



          All I did was enter this simple command to get rid of over 400 MB worth of files in the root partition that were no longer needed.



          sudo apt-get autoremove


          That gave my root file system the breathing space it needed. Now everything runs great. Guess a 10 GB root directory isn't enough to handle over two years worth of Ubuntu updates.



          If anybody cares, the system has been running Ubuntu 10.04 since it came out. The system updates at least once a week. Today's date is 9-6-2012, so that's almost 2 1/2 years worth of updates.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 6 '12 at 10:29









          Peachy

          4,91172843




          4,91172843










          answered Sep 6 '12 at 6:46









          Happy Gecko

          212




          212












          • when your problem is space, I also suggest askubuntu.com/questions/17432/…
            – ecoologic
            Jan 20 '13 at 0:42










          • +1 for pointing out space issue -- this solved my problem.
            – yuval
            May 30 '13 at 20:26


















          • when your problem is space, I also suggest askubuntu.com/questions/17432/…
            – ecoologic
            Jan 20 '13 at 0:42










          • +1 for pointing out space issue -- this solved my problem.
            – yuval
            May 30 '13 at 20:26
















          when your problem is space, I also suggest askubuntu.com/questions/17432/…
          – ecoologic
          Jan 20 '13 at 0:42




          when your problem is space, I also suggest askubuntu.com/questions/17432/…
          – ecoologic
          Jan 20 '13 at 0:42












          +1 for pointing out space issue -- this solved my problem.
          – yuval
          May 30 '13 at 20:26




          +1 for pointing out space issue -- this solved my problem.
          – yuval
          May 30 '13 at 20:26











          1














          What finally helped me was purging (not removing!) all the apt-get packages related to mysql except for libmysqlclient16 which was in de-install status (not sure what that is).



          So, just do:



          dpkg --get-selections | grep mysql


          and then:



          sudo apt-get purge <package_name>


          Start from common then go to client and then the server.






          share|improve this answer























          • I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
            – Nephente
            Oct 4 '15 at 16:29










          • THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
            – krisanalfa
            Dec 1 '15 at 9:26










          • how to find the blocked port 3306?
            – Sushivam
            Nov 11 '16 at 5:41
















          1














          What finally helped me was purging (not removing!) all the apt-get packages related to mysql except for libmysqlclient16 which was in de-install status (not sure what that is).



          So, just do:



          dpkg --get-selections | grep mysql


          and then:



          sudo apt-get purge <package_name>


          Start from common then go to client and then the server.






          share|improve this answer























          • I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
            – Nephente
            Oct 4 '15 at 16:29










          • THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
            – krisanalfa
            Dec 1 '15 at 9:26










          • how to find the blocked port 3306?
            – Sushivam
            Nov 11 '16 at 5:41














          1












          1








          1






          What finally helped me was purging (not removing!) all the apt-get packages related to mysql except for libmysqlclient16 which was in de-install status (not sure what that is).



          So, just do:



          dpkg --get-selections | grep mysql


          and then:



          sudo apt-get purge <package_name>


          Start from common then go to client and then the server.






          share|improve this answer














          What finally helped me was purging (not removing!) all the apt-get packages related to mysql except for libmysqlclient16 which was in de-install status (not sure what that is).



          So, just do:



          dpkg --get-selections | grep mysql


          and then:



          sudo apt-get purge <package_name>


          Start from common then go to client and then the server.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 6 '12 at 1:46









          belacqua

          15.7k1472103




          15.7k1472103










          answered May 5 '12 at 14:02









          Gilad Shahrabani

          111




          111












          • I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
            – Nephente
            Oct 4 '15 at 16:29










          • THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
            – krisanalfa
            Dec 1 '15 at 9:26










          • how to find the blocked port 3306?
            – Sushivam
            Nov 11 '16 at 5:41


















          • I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
            – Nephente
            Oct 4 '15 at 16:29










          • THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
            – krisanalfa
            Dec 1 '15 at 9:26










          • how to find the blocked port 3306?
            – Sushivam
            Nov 11 '16 at 5:41
















          I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
          – Nephente
          Oct 4 '15 at 16:29




          I don't think this answer is helpful. Problem was the blocked 3306 port, not broken MySQL packages.
          – Nephente
          Oct 4 '15 at 16:29












          THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
          – krisanalfa
          Dec 1 '15 at 9:26




          THIS COMMAND WILL REMOVE ANY PACKAGES DEPENDS TO libmysqlclientXX
          – krisanalfa
          Dec 1 '15 at 9:26












          how to find the blocked port 3306?
          – Sushivam
          Nov 11 '16 at 5:41




          how to find the blocked port 3306?
          – Sushivam
          Nov 11 '16 at 5:41


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f79226%2fcant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-sock%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局