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>

完美解决!

相关推荐
devilnumber1 小时前
MySQL 性能优化・诗意化记忆
数据库·mysql·性能优化
瀚高PG实验室1 小时前
PostgreSQL pg_basebackup 和 pg_rewind 可覆盖源端超级用户选择的无关文件HGVE-2026-E010
数据库·postgresql·瀚高数据库
宠友信息3 小时前
社区类源码开发实践中的仿小红书系统技术要点分析
java·spring boot·redis·mysql·uni-app·vue·内容运营
OceanBase数据库官方博客3 小时前
亮相“十五五”公积金高质量发展大会“AI 数据库”助力智慧公积金升级
数据库·人工智能
Lyra_Infra4 小时前
MySQL Docker 误删恢复:binlog PITR
mysql·docker·命令行
龙虾PRO4 小时前
高并发场景数据库调优实操:目标定位、监控方法与优化维度全解析
数据库·oracle
达梦产品与服务4 小时前
SQLark 实战 | 高频 SQL 脚本的导入、管理与复用
数据库·sql·数据库开发·数据库运维·脚本管理·sqlark百灵连接·sql脚本
南城以南溫暖如初1474 小时前
从零搭建24小时自助健身系统:技术选型与核心模块实战
java·spring boot·redis·mysql·vue·mybatis
InfinitePlus5 小时前
redis数据持久化
数据库·redis·缓存
忧郁的橙子.5 小时前
深入浅出etcd与Raft:从核心组件到数据一致性原理
数据库·etcd