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

相关推荐
曹牧1 分钟前
Oracle:硬解析
数据库·oracle
请你喝好果汁64110 分钟前
cellchat
数据库·oracle
小宇的天下15 分钟前
Calibre eqDRC(方程化 DRC)核心技术解析与实战指南(14-1)
数据库·windows·microsoft
傻啦嘿哟22 分钟前
Python自动整理音乐文件:按艺术家和专辑分类歌曲
数据库·python·分类
哈里谢顿24 分钟前
MySQL 和 Redis搭配使用指南
redis·mysql
酸菜牛肉汤面25 分钟前
16、事物的四大特性(ACID)介绍一下?
数据库·oracle
FourAu33 分钟前
更改mysql在电脑中的存储位置
数据库·mysql
AI题库1 小时前
PostgreSQL 18 从新手到大师:实战指南 - 2.4 备份与恢复策略
数据库·postgresql·oracle·数据库备份
晴天¥1 小时前
Oracle中的概要文件
运维·数据库·oracle
一 乐1 小时前
健康管理|基于springboot + vue健康管理系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·后端·学习