解决连接mysql时报错"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"

命令行连接mysql时,报了“Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘”的错误;用Navicat连接是报62号错误。

首先确定我本机是装了mysql的

尝试用安全模式启动mysql,命令行执行:

/usr/local/bin/mysqld_safe

完了之后运行mysql,成功了。

解决连接mysql时报错"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"

时间: 2024-10-12 15:40:27

解决连接mysql时报错"Can't connect to local MySQL server through socket '/tmp/mysql.sock'"的相关文章

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 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): 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

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

Mac端解决:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

安装mysql但是从来没启动过,今天一启动就报错: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 其实是mysql服务没起来... localhost:~ miaoying$ mysql.server start Starting MySQL ... SUCCESS! 然后再去sudo mysql就行了 Mac端解决:Can't connect to local MySQL server thro

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

我在源码编译安装mysql后,虽然mysql服务可以正常启动,但是当我直接执行mysql后,出现了错误. 错误提示如下: [[email protected] ~]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 出现错误原因: 由于mysql 默认的mysql.sock 是在/var/lib/mysql/mysql.sock,但linux系统总

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

1.今天安装了一个mysql 5.7 的二进制安装方式,在连接mysql数据库的时候报了如下错误: [[email protected] mysql]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 2.根据提示应该是sock文件不在,通过查看进程配置,发现如下 [[email protected] bin]# ps -ef | grep mys

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

原因:找不到mysql.sock文件 解决方法: 1 找到mysql.sock文件位置 echo "show variables" | mysql | grep "socket"或者echo "status" | mysql | grep "socket" 2 ln -s /var/lib/mysql /mysql .sock /tmp/mysql .sock 将两个文件做一个软连接 ERROR 2002 (HY000): C

Mac OS X下MySQL出现Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的问题

网上类似的很多,大都是说修改my.cnf之类的,在我这种情况下不凑效,另外,好多都是Linux下的,试了好久,最后的原因竟然相当简单:MySQL服务没起来. 因为对mysql.sock文件不是很熟,刚开始很大的时间都浪费在了这上面,重装后都不行,后来进入/usr/local/mysql/bin/下使用mysqld启动,出现下面的问题 好吧,我用root启动,结果又出现 Please read "Security" section of the manual to find out ho