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) 完美解决!

相关推荐
zhaoyong22214 分钟前
SQL如何统计每个用户的首次行为时间_MIN聚合与分组
jvm·数据库·python
2501_9010064725 分钟前
C#怎么实现配置热更新 C#如何在运行时动态刷新配置文件不需要重启程序【技巧】
jvm·数据库·python
m0_4708576427 分钟前
HTML怎么创建响应式图片备选方案_HTML srcset与sizes结构【详解】
jvm·数据库·python
lifewange37 分钟前
PostgreSQL介绍
数据库·postgresql
oradh1 小时前
Oracle数据库中的Java概述
java·数据库·oracle·sql基础·oracle数据库java概述
2301_795099742 小时前
如何优化SQL中大批量数据的物理删除_分批次与间隔控制
jvm·数据库·python
2301_812539672 小时前
CSS如何引入CSS形状生成器_通过自定义属性实现图形化样式
jvm·数据库·python
maxmaxma2 小时前
Claude Code集成DeepSeek-V4-pro全栈开发 - MCP 连接数据库
数据库·ai
lb29172 小时前
navicat连接Oracle报错了:“身份证明检索失败”
数据库·oracle·连接oracle数据库报错
xfhuangfu2 小时前
Oracle 12.2 ORA-600 数据库发生重启案例
数据库·oracle