MySQL报ERROR 2002 (HY000)解决

今天在连接客户服务器时MySQL的时候报:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql/mysql.sock' (2)

root@XXX \~\]# mysql -uroot -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql/mysql.sock' (2) ## 解决方案: 在登录MySQL数据库的时候用一下命令 ```sql mysql -h 127.0.0.1 -uroot -p ``` \[root@XXX \~\]# mysql -h 127.0.0.1 -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \\g. Your MySQL connection id is 7812 Server version: 5.7.18-log Source distribution Copyright © 2000, 2017, 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\> ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/9434fa39dae44445bd35fbdd063ed925.png) 完美解决!

相关推荐
Access开发易登软件18 小时前
数据处理中的两大基石:何时选择Excel,何时考虑Access
数据库·信息可视化·excel·vba·access
Alex老夫子18 小时前
android room数据库增加字段注意事项
android·数据库
9稳18 小时前
基于单片机的家庭安全系统设计
开发语言·网络·数据库·单片机·嵌入式硬件
逍遥德18 小时前
Postgresql 系统表作用解释
数据库·后端·sql·postgresql
MonkeyKing_sunyuhua18 小时前
ES文档序号写错的问题的修复
java·数据库·elasticsearch
饱饱要坚持可持续发展观19 小时前
Liquibase preConditions 执行前判断详解
数据库·liquibase
代码煮茶君19 小时前
MySQL 数据库死锁及核心机制全解析
android·数据库·mysql
咕噜企业分发小米19 小时前
豆包大模型在药物研发中的知识检索效率如何?
java·开发语言·数据库
LaughingZhu19 小时前
Product Hunt 每日热榜 | 2026-01-20
数据库·人工智能·经验分享·神经网络·搜索引擎·chatgpt
SJLoveIT19 小时前
sql注入攻击的防御思路总结
数据库·sql