MySQL 无法连接 - 错误 2002 (HY000)。请帮忙!
我正在使用 mysql,试图向 Debian 服务器上的数据库添加一些外键...突然间我开始收到此消息:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/ var/run/mysqld/mysqld.sock' (111)
无论我做什么,我都会收到此消息。如果我重新启动 mysql,它只会多次吐出这些废话。
我已经重新启动服务器很多次了,但它并没有消失。我不知道我做了什么......我只是改变了一个实际上已经生产了一年多的数据库的模式。
我最近更改了该服务器的域名,但是更改后mysql工作了几天。
除此之外,我想不出我做了什么不同的事情。
请帮忙。我必须让这个数据库重新上线。
编辑:高兴,mysql通过尝试将外键添加到一个奇怪的数据库中而损坏了我的实际数据库。数据库已经完蛋了。
还好我有备份,但这不真实。
I was using mysql, trying to add some foreign keys to a database on a Debian server... and all of a sudden I started getting this message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
No matter what I do, I get this message. If I restart mysql, it just spits this crap out a bunch of times.
I have rebooted the server a bunch of times, and it's not going away. I have no idea what I did... I was just changing the schema of a database that has actually been in production for over a year.
I recently changed the domain name of this server, but mysql was working for a few days after this change.
Beyond that, I can't think of anything I did differently.
Please help. I have to get this database back online.
EDIT: Joy, mysql corrupted my actual database by trying to add foreign keys into a freaking database. The database is toast.
Good thing I have backups, but this is unreal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是一个有用的链接。它建议启动 mysql 守护进程,然后输入 mysql。
如果这不起作用,请检查 mysql 客户端和服务器的配置文件,以确保它们指向正确的位置。
This seems to be a useful link. It suggests starting mysql daemon, then type mysql.
If that does not work check the config files for both your mysql client and server to make sure they are pointing to the correct locations.
事实证明数据库已损坏。如果您也遇到这样的错误,请尝试显示表并从 mysql 附带的基本默认数据库中选择数据,以确保万无一失。
就我而言,删除和添加外键实际上破坏了我的数据库,这解释了为什么重新启动服务器或重新启动 mysqld 没有效果。
It turns out that the database was corrupted. If you're also getting an error like this that defies reason, try showing tables and selecting data out of your basic default databases that comes with mysql just to be sure.
In my case, dropping and adding foreign keys actually destroyed my database, which explains why rebooting the server or restarting mysqld was having no effect.