连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

报错:

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

1、楼主是新安装的mysql,注意新安装完成不会默认启动服务

2、百度上各种处理办法均不对,查看数据库状态发现未启动!!!

3、重启把服务拉起即可成功连接:systemctl start mariadb.service

4、安装新服务后一定要先检查服务的状态信息,再去判断报错!!!

连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

原文地址:https://www.cnblogs.com/python-wen/p/12291404.html

时间: 2024-10-06 13:29:02

连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)的相关文章

长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

mac上安装过mysql: 然而,尝试连接时报错: $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 尝试去查看mysql.socket文件,发现没有.. $ which mysql /usr/local/bin/mysql 然后试试重启mysql: $ mysql.server start

mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法

首先安装 homebrew 再 brew install mysql 之后连接 mysql 无论是登录还是修改初始密码都会报如下的错误 ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2) 运行如下解决:参考 http://www.thinksaas.cn/group/topic/347978/ unset TMPDIR mysql_install_db --v

Mac brew 安装mysql 报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket

安装mysql 最新版 56 brew install mysql 启动报错 ben:~ soul$ which mysql /usr/local/bin/mysql ben:~ soul$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 解决办法 运行 ben:~ soul$ mysql.server start Starting MySQL .

MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[[email protected] mysql3307]# /opt/mysql3307/bin/mysql -upisp [email protected]123 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.so

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

安装完mysql连接报错: [[email protected] app]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) [[email protected] app]# mysql -uroot -p Enter password:  ERROR 2002 (HY000): Can't connect to local M

mariadb报:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111 "Connection refused")

我这边移除了mysql.sock文件后,重启服务就成功了. 还有一种情况,就是加入galera后,可能是server.cnf配置信息出了问题导致的,修改后,重新运行galera即可,数据库就可以启动成功了. mariadb报:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111 "Connection refused") 原文地址:h

Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的解决办法

我的环境:Mac 10.11.6 ,mysql  5.7.14  . mac mySql 报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 这个错是链接时报的错,要链接必须启动.修复的时候首先要启动mysql. 首先来了解一下 mysql.sock的作用: Mysql有两种连接方式: (1),TCP/IP (2),socket 对mysql.sock来说,其

解决MySQL报错ERROR 2002 (HY000)

今天在为新的业务线搭架数据库后,在启动的时候报错 [email protected]:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 在此记录一下,希望能够给遇到此问题的兄弟们提供一个解决问题的思路,有了思路后一步一步排查问题就比较容易了,但是我这个问题比较奇怪,如果有了解的兄

mysql登陆启动报错 ERROR 2002 (HY000) 解决方法

报错信息 登陆数据库报错:` ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")` 重启服务报错:Job for mariadb.service failed because the control process exited with error code. See &quo