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

相关推荐
luoluoal15 小时前
基于python的英汉电子词典软件(源码+文档)
python·mysql·django·毕业设计·源码
言之。15 小时前
DDIA第四章 数据库存储引擎与索引技术深度解析
数据库·ddia
山沐与山15 小时前
【Redis】读写锁实战详解:读多写少场景的性能优化利器
数据库·redis·性能优化
memgLIFE15 小时前
SQL 优化方法详解(1)
java·数据库·sql
UCH1HA15 小时前
MySQL主从复制与读写分离
linux·mysql·集群
小宇的天下15 小时前
Calibre 3Dstack--每日一个命令day 6 [process和export layout](3-6)
java·前端·数据库
自燃人~16 小时前
为什么MySQL用b+不用B数
数据库·mysql
做cv的小昊16 小时前
【TJU】信息检索与分析课程笔记和练习(6)英文数据库检索—web of science
大数据·数据库·笔记·学习·全文检索
warton8817 小时前
ubuntu24.04 安装mysql8.0.36
linux·运维·mysql
严同学正在努力17 小时前
VMware安装银河麒麟V10操作系统X86_64全过程
数据库·鸿蒙系统·kylin