1.登录mysql:mysql -u root p   输入root密码后报错

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)

2.检查mysql服务:ps -ef | grep mysqld

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)发现没有mysql服务,原来报错是因为mysql没有启动,哈哈!

3.启动MySQL服务:mysql.server start

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)

你可以再查看一下MySQL服务.

4.连接数据库:mysql -u root  -p 

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2) 

相关文章:

  • 2021-05-24
  • 2021-06-12
  • 2021-11-07
  • 2021-08-23
  • 2021-06-28
  • 2021-10-04
猜你喜欢
  • 2021-04-23
  • 2021-07-25
相关资源
相似解决方案