刚刚尝试访问终端(flush_hosts)中的一些mysqladmin权限,我注意到套接字问题已经重新出现错误
无法通过socket' /tmp/mysql.sock'连接到本地MySQL服务器; (2)*。
我目前没有运行任何服务器。
如何解决这个问题?
答案 0 :(得分:0)
哇,你自己提到,你必须'运行一个可以连接它的服务器,请考虑:
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>
答案 1 :(得分:0)
好的,似乎一路上肯定有一些混乱的配置。我回过头来安装最新的.DMG for MySQL,现在一切正常。如果你有.sock问题,我猜你最好的办法是重新安装MySQL,它不需要很长时间。谢谢你的帮助!
答案 2 :(得分:0)
尝试删除database.yml
文件中的套接字字段,或者如果您知道机器中的位置,请使用正确的路径更改mysql.sock
。