0

Having just tried to access some mysqladmin privileges within terminal (flush_hosts), I have noticed that the socket problem has resurfaced with the error

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)*.

I have no servers running currently.

How can this be solved?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
dazziola
  • 193
  • 1
  • 3
  • 14
  • wait, are you running a server or not??? – A Person Jul 20 '12 at 17:39
  • If you don't have a MySQL server running currently, how do you expect to connect to it?! –  Jul 20 '12 at 17:50
  • By no servers running currently, I meant extra servers (such as MAMP). I have tried using mysqld only to get the message "mysql.host doesnt exist" - apologies for the noobish way the post was written. – dazziola Jul 20 '12 at 18:08

3 Answers3

0

Wow, yourself mentioned, you 'must' run a server that can to connect it,Please consider:

root@debian:/etc/init.d# /etc/init.d/mysql stop
[ ok ] Stopping MySQL database server: mysqld.
root@debian:/etc/init.d# mysql 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@debian:/etc/init.d# /etc/init.d/mysql start
[ ok ] Starting MySQL database server: mysqld ..
[info] Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly..
root@debian:/etc/init.d# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.24-5 (Debian)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
  • Thanks for the response. As mentioned above, I meant no other servers running such as MAMP. Also there's no init.d file located in my /etc/ folder, so I have been unable to carry out solutions involving init.d – dazziola Jul 20 '12 at 18:09
0

OK, it appears that there must have been some messed up configurations along the way. I went back to scratch and installed the latest .DMG for MySQL and everything is working fine now. If you have .sock issues I'm guessing your best bet is to reinstall MySQL, it doesn't take very long at all. Thanks for the help!

dazziola
  • 193
  • 1
  • 3
  • 14
0

try removing socket field in the database.yml file or change it with the right path to mysql.sock if you know where it is in you machine.

serengeti12
  • 5,205
  • 4
  • 23
  • 27