找回密码
 注册
查看: 615|回复: 0

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-9-22 11:55:32 | 显示全部楼层 |阅读模式
[root@ceph1 /]# mysql -uroot -p
4 z, O( x/ W) [. F3 @5 HEnter password: $ l( p$ I9 ^* R% a/ Z
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
# W/ D8 A1 v/ f, f[root@ceph1 /]#
  s1 g2 z8 c0 O& v4 k  s, r* F- A% C[root@ceph1 /]# " a' R( R% Q2 g+ y: x$ U  N1 c* D
[root@ceph1 /]#
  S' m* u6 `0 l/ t添加个client的配置6 E" Y$ O" y  N6 ^* @" X) _$ d4 Q
[root@ceph1 /]# vim /etc/my.cnf( u8 S) p( J: o7 W4 R* R

- }* h$ d8 I- \) a$ X! o$ L* ^0 f[client]3 Q5 A# h& f* b% E3 O* ~1 t
port=3306
5 k- C0 ^9 s9 o, \# [4 A# Y( Osocket=/var/lib/mysql/mysql.sock1 e8 l  L; `8 ^! D9 Q( b$ u; _; q! I

7 v8 s0 J/ i6 e  B7 E[root@ceph1 /]# service mysqld restart 3 h' [8 n0 ~4 y/ g4 ]2 G
Shutting down MySQL.. SUCCESS!
$ L2 A% h* G: R! I; A& N* O3 TStarting MySQL.. SUCCESS! 2 J( B( j- k9 u. o
[root@ceph1 /]# mysql -uroot -p
% F7 l+ ]2 X6 T( aEnter password: . p1 W5 d0 m, G7 A* u8 [
Welcome to the MySQL monitor.  Commands end with ; or \g.5 f4 F5 P% g: X+ k! h3 N- h
Your MySQL connection id is 1
3 n  Q9 }( Q# W4 pServer version: 5.6.20 Source distribution
7 n- E) @+ `, k3 A# }$ c* S; {! o; p; f" b2 K
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.- k8 S, L9 D  E. W

+ Q# ?/ r8 P! N7 f# C0 H, eOracle is a registered trademark of Oracle Corporation and/or its
1 D3 [( N% b0 }7 d' i( X5 {3 Maffiliates. Other names may be trademarks of their respective3 f" N$ Q6 |( j: G% |9 B! j
owners.
' K! A7 @" u' J  P
% k' G9 ~& {& Y* d7 m. IType 'help;' or '\h' for help. Type '\c' to clear the current input statement.9 p6 }& A' I( z* ^4 s/ p& y

6 Z) H/ m. x( Ymysql>
$ F( S6 Y7 y% }. f) r1 K4 Imysql>
% T/ n$ w' V: E& r! r
) H! {0 |, `+ s3 A0 v
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:13 , Processed in 0.015093 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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