欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

linux安装MySQL后输入mysql显示 ERROR 2002 (HY000): Can't connect to local MySQL server through socket

程序员文章站 2022-03-22 11:53:00
我是小白,大佬勿喷 linux安装MySQL后输入 显示 解决办法 输入 然后输入 问题解决 ......

我是小白,大佬勿喷
***

linux安装mysql后输入mysql显示

error 2002 (hy000): can't connect to local mysql server through socket
解决办法
输入service mysql restart

root@des:/# service mysql restart
 * stopping mysql database server mysqld                                                                         [ ok ]
 * starting mysql database server mysqld                                                                                no directory, logging in with home=/
                                                                                                                 [ ok ]

然后输入mysql

root@des:/# mysql
welcome to the mysql monitor.  commands end with ; or \g.
your mysql connection id is 4
server version: 5.7.26-0ubuntu0.18.04.1 (ubuntu)

copyright (c) 2000, 2019, 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>

问题解决