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>

完美解决!

相关推荐
丙氨酸長鏈2 小时前
Web前端入门第 问:JavaScript 一个简单的 IndexedDB 数据库入门示例
前端·javascript·数据库
独行侠影a3 小时前
APScheduler+Redis 分布式定时任务:解决多实例任务重复执行
数据库·redis·分布式
传说故事3 小时前
数据库中一些常用英文单词含义
数据库·oracle
夏贰四3 小时前
中小企业搭建业务中台如何控成本?业务中台轻量化落地分几步实施?
数据库·业务中台
林焱RPA4 小时前
影刀RPA200篇纪念版:最实用的20个自动化场景大盘点
数据库
名字还没想好☜4 小时前
Go 的 time.After 在 select 循环里内存泄漏:定时器堆积原理与 timer.Reset 正确姿势
java·数据库·golang·go·goroutine
每天都要进步哦6 小时前
SQL单行函数详解:字符、数字、日期、转换与通用函数全解析
数据库·mysql
不剪发的Tony老师6 小时前
VeloxDB:一款免费开源的轻量级数据库管理工具
数据库·sql
dotnet906 小时前
批量生成所有表的修改脚本
数据库·sql·oracle
@Mike@6 小时前
06-数据库学习笔记(存储模型与数据压缩)
数据库·笔记·学习