易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 615|回复: 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
( |4 Q9 B7 L( T: W. {/ w! K( L: AEnter password: ( _0 v9 ~/ O+ K! w
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
( w- a5 k3 f8 H8 c$ R) k[root@ceph1 /]#
3 K) Q, i* w3 X7 W4 r6 X[root@ceph1 /]#
+ Z2 J+ ?9 u5 K& A% v/ M[root@ceph1 /]# # S& b# z6 F  P  [5 \9 `* F
添加个client的配置% J# n: R* L* }$ g4 n# d1 {
[root@ceph1 /]# vim /etc/my.cnf
/ D3 G3 ~' o! `( A: c3 f+ Q5 K' `: r
[client]8 U' s7 w8 F7 j. b1 p3 T. X4 u2 n
port=3306! d6 m& }9 ?& k: P+ X
socket=/var/lib/mysql/mysql.sock6 E7 o2 c( M- S2 ?! D( P

, G3 E3 J8 ?( G1 k' c# r[root@ceph1 /]# service mysqld restart 8 h! |' Q- {0 p4 @. q, {
Shutting down MySQL.. SUCCESS! $ Y; n; U5 K; z5 k, o9 w
Starting MySQL.. SUCCESS! 1 y; f  h! c5 I# S$ V1 G& y
[root@ceph1 /]# mysql -uroot -p
# r/ Z5 Q! R( F* VEnter password:
3 p4 P/ B/ k1 C& ], g$ JWelcome to the MySQL monitor.  Commands end with ; or \g.5 B( l: U# q/ ]/ b
Your MySQL connection id is 16 u( r" T( |. u7 |1 y: x1 h. e
Server version: 5.6.20 Source distribution
2 r4 x0 \; D6 Q& P
( q5 r0 l7 s6 d' rCopyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
8 s9 A/ c; w/ z6 N. A. Y- O- X6 F' T9 N
Oracle is a registered trademark of Oracle Corporation and/or its. f) c/ I4 x; s( `# n+ R1 v2 W" _
affiliates. Other names may be trademarks of their respective, [+ v# t6 u: N( h3 S
owners.1 \# e1 c, p- E+ n
$ p) U- `. i: h% _) n
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
. s+ p/ c+ S1 ?# J9 x& V) \2 F+ M7 @5 i0 I7 Q% A! e
mysql> ( x& s, e; R4 Q0 b
mysql> * {" z- p3 O( }! W5 t) V( [* V9 e

; R* ^: Q& W' X) _# ]; E
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 13:43 , Processed in 0.038980 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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