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>

完美解决!

相关推荐
杜子不疼.18 分钟前
【Qt初识】信号槽(三):机制意义、断开连接与 Lambda 表达式
开发语言·数据库·qt
BomanGe11 小时前
NSK W1501FA高速精密滚珠丝杠技术手册
数据库·经验分享·规格说明书
kiki-bf2 小时前
可用的mysql本地安装教程
数据库·mysql
携程DBA2 小时前
数据库软限制相关研究
linux·mysql·性能
多巴胺梦想家3 小时前
数据库恢复技术:当灾难来临
网络·数据库·oracle
Anokata3 小时前
MYSQL SQL 执行系列2
mysql
北冥you鱼3 小时前
Go 语言初始化 MySQL 数据库实战指南:从零到生产环境部署
数据库·mysql·golang
SelectDB3 小时前
云数仓费钱?用 SelectDB Serverless 三步配出秒级弹性,最高降本 70%
数据库·云原生·数据分析
琢森3 小时前
服务器崩溃后,我是怎么用一条备份脚本救回全部数据的
mysql
time展天13 小时前
Dddify:给 ASP.NET Core 项目一套轻量、清晰、可落地的 DDD 基础设施
数据库·后端·asp.net