2012-07-20 71 views
-1

刚走试图终端(flush_hosts)中访问一些中mysqladmin权限连接到本地MySQL服务器,我已经注意到,插座问题与错误无法通过插座TMP /的mysql.sock

复出无法通过套接字'/tmp/mysql.sock'(2)*连接到本地MySQL服务器。

我目前没有运行服务器。

这怎么解决?

+0

等待,你是否运行服务器? – 2012-07-20 17:39:21

+0

如果您目前没有运行MySQL服务器,您希望如何连接它? – duskwuff 2012-07-20 17:50:54

+0

目前没有服务器运行,我的意思是额外的服务器(如MAMP)。我已经尝试使用mysqld只是为了得到消息“mysql.host不存在” - 道歉为写这篇文章的noobish方式。 – dazziola 2012-07-20 18:08:06

回答

0

哇,你自己提到的,“必须”运行的服务器,可以将其连接,请考虑:

[email protected]:/etc/init.d# /etc/init.d/mysql stop 
[ ok ] Stopping MySQL database server: mysqld. 
[email protected]:/etc/init.d# mysql 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 
[email protected]:/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.. 
[email protected]:/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> 
+0

感谢您的回复。如上所述,我的意思是没有运行其他服务器,如MAMP。此外,我的/ etc /文件夹中没有init.d文件,所以我一直无法执行涉及init.d – dazziola 2012-07-20 18:09:23

+0

的解决方案。您的发行版是什么? – 2012-07-21 05:26:40

0

OK,看来一定有沿途的一些乱七八糟的配置。我重新开始为MySQL安装最新的.DMG,现在一切正常。如果你有.sock问题,我猜你最好的选择就是重新安装MySQL,它不需要很长时间。谢谢您的帮助!

0

尝试删除database.yml文件中的套接字段,或者将其正确路径更改为mysql.sock如果您知道它在机器中的位置。

相关问题