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

相关推荐
这周也會开心13 分钟前
Spring框架
java·数据库·spring
gys98951 小时前
uniapp使用sqlite模块
数据库·sqlite·uni-app
凌冰_1 小时前
Java Maven+lombok+MySql+HikariCP 操作数据库
java·数据库·maven
武子康1 小时前
Java-165 Neo4j 图论详解 欧拉路径与欧拉回路 10 分钟跑通:Python NetworkX 判定实战
java·数据库·性能优化·系统架构·nosql·neo4j·图论
岳麓丹枫0012 小时前
pg_stat 视图介绍
数据库·postgresql
弗朗凌戈2 小时前
影院票务管理系统oracle
数据库·oracle·vr
·云扬·2 小时前
MySQL主从数据一致性校验工具:pt-table-checksum 详解
数据库·sql·mysql
wudl55662 小时前
Python 虚拟环境和包管理
数据库·python·sqlite
那我掉的头发算什么3 小时前
【数据库】事务
数据库·sql·mysql·github·数据库开发
全栈工程师修炼指南3 小时前
DBA | Oracle 数据备份迁移之传统 exp/imp 工具实战指南
数据库·oracle·dba