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>

完美解决!

相关推荐
破碎的南瓜5 分钟前
sqli--sql注入过关笔记(1,2,3,4,5,9)
数据库·笔记·sql
吠品2 小时前
Zabbix Web界面误报Server未运行的排查与解决
java·服务器·数据库
SelectDB2 小时前
Apache Doris Variant 动态 JSON 实战教程:从建表到跑通 100M Agent 日志查询
数据库
sg_knight2 小时前
MySQL 存储过程详解:从入门到实战
android·数据库·mysql·database·dba·关系型数据库·db
星空露珠3 小时前
28种颜色对应名称,
开发语言·数据库·算法·游戏·lua
踏月的造梦星球4 小时前
DM8 DSC 单机双实例部署
运维·开发语言·数据库
Database_Cool_4 小时前
企业级多模态分析计算引擎选型:首选 AnalyticDB MySQL 向量 + SQL + 实时一体化方案
数据库·sql·mysql
SelectDB4 小时前
从 Oracle、Hadoop 到 Apache Doris:哥瑞利泛半导体智能制造数据平台实践
数据库
ihuyigui4 小时前
海外签收通知短信接口
android·java·开发语言·前端·数据库·后端
海棠Flower未眠4 小时前
SpringBoot 消息死信队列(荣耀典藏版)
java·数据库·spring boot