易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 608|回复: 0
收起左侧

ERROR 2002 (HY000): Can't connect to local MySQL server through socket mysql报错解

[复制链接]
发表于 2022-9-22 11:55:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
[root@ceph1 /]# mysql -uroot -p
% w" t/ m0 W% S+ T+ L  G& n$ ^Enter password: : B( l2 u$ {+ N1 c
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
' j' R& H& a3 ~$ M) Q, w[root@ceph1 /]#
4 }0 O* d3 ^$ k6 u! \* u* s) @[root@ceph1 /]#
# R/ z+ c4 U/ b' a9 g$ `, I5 z[root@ceph1 /]#
0 h; {2 @8 I9 W+ _: T# s; `& ~添加个client的配置
: ^: B5 v# D% D( t/ G/ {2 I2 @7 R& G[root@ceph1 /]# vim /etc/my.cnf* {& t: V) V& r# m7 E

1 w4 j, {  Z) f1 B[client]
, m: f: c, f. M$ ~" q2 m' wport=3306
1 N" u. F! ~& n/ t6 ^; r" J, \# w1 rsocket=/var/lib/mysql/mysql.sock+ u1 Q4 L1 \( _5 ]- |" @* H/ A* {

; u" P6 I  W" R- H[root@ceph1 /]# service mysqld restart - ]8 m# f+ V  u/ p! }, K" U& d/ a
Shutting down MySQL.. SUCCESS!
( k) z( ?( |  U$ h, e8 L* Q& iStarting MySQL.. SUCCESS!
# C) @% C1 ^) {0 L- ^[root@ceph1 /]# mysql -uroot -p ( b7 F" \$ I! h" M
Enter password:
) i% ]" n8 r6 y: c9 ZWelcome to the MySQL monitor.  Commands end with ; or \g.! d. Z$ Q; k; ~& @5 X
Your MySQL connection id is 1
; T! D$ ^/ m9 O# o5 @Server version: 5.6.20 Source distribution6 ?9 n, G, R1 j+ _! j
& n- B3 U2 ?5 Q$ c+ e$ B: l* F
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.. A- ^5 C) s' Q) e( P
! t, v' g; B+ v" y
Oracle is a registered trademark of Oracle Corporation and/or its: ^1 t/ A0 O! F/ D* k
affiliates. Other names may be trademarks of their respective' J. Q: L& n  H
owners.; x) Y2 j0 T4 e2 K0 T" D3 ?

( m& Z, v- e8 t+ v/ L( @. r) b0 FType 'help;' or '\h' for help. Type '\c' to clear the current input statement.% p, h2 ~! o  b

9 |) F9 A! H4 |  Emysql>
/ L- j/ d4 \# s$ O8 a' b% w3 m( rmysql>
3 R. D" L9 [1 t' X. v" M3 \3 S; W4 p+ r
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:34 , Processed in 0.072871 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表