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有两种连接方式:
创建目录:sudo mkdir /var/mysql
创建软链接:sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
如果提示: ln: creating symbolic link `/data/mysqldata/mysql.sock' to `/tmp/mysql.sock': File exists
删除之前的mysql.sock文件
参考文章:http://www.jianshu.com/p/2fb9a3bb12f6,http://blog.csdn.net/sarahhuangzht/article/details/51508112
分类: MySQL
mysql有两种连接方式:
mysql 31108 30650 0 Sep10 ? 00:03:17 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/Wonhigh-Test16.err --pid-file=/var/lib/mysql/Wonhigh-Test16.pid --socket=/var/lib/mysql/mysql.sock --port=3306
[root@Wonhigh-Test16 ~]#
[root@Wonhigh-Test16 ~]# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql1.sock
[root@Wonhigh-Test16 ~]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@Wonhigh-Test16 ~]#
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 127
Server version: 5.6.19-log
Copyright (c) 2000, 2014, 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.
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 121
Server version: 5.6.19-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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.
Bye
[root@Wonhigh-Test16 ~]#
Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的解决办法的更多相关文章
- linux云服务器mysql ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
一早上过来发现网站打开报错,数据库连接不上.. 有人改密码? putty进去,mysql -uroot -p 输入密码后,报错 ERROR 2002 (HY000): Can't connect to ...
- mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
解决方案如下:
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
有时候,当我们使用"mysql"."mysqladmin"."mysqldump"等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场 ...
- mysql登陆报错(ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2))
部署mysql版本信息 version: 5.6.21 具体现象: mysql服务能够正常启动如下: [root@localhost ~]# service mysqld restart Shutti ...
- [ 转载 ] Centos 安装mysql后启动失败 出现 ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
MySQL Daemon failed to start Mysql出问题一定要学会查看log https://blog.csdn.net/shuai825644975/article/details ...
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket
原文链接:https://blog.csdn.net/u011262253/article/details/82802157 一.错误现场还原: 下面我们通过三种方式来连接,然后观察提示的错误信息: ...
- mysql安装错误之->ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
有时候,当我们使用“mysql”.“mysqladmin”.“mysqldump”等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场还原:下面我们通过三种方式来连接,然后观察提示的错误信息: ...
- (转)ERROR 2002 (HY000): Can't connect to local MySQL server through socket '***' (2)
有时候,当我们使用“mysql”.“mysqladmin”.“mysqldump”等命令管理数据库时,服务器抛出类似如下错误: 1 ERROR 2002 (HY000): Can't connect ...
- mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
好久不用mysql,今天突然想用的时候, mysql -uroot -p 直接报了下面的错误 ERROR 2002 (HY000): Can't connect to local MySQL serv ...
随机推荐
- 调试asp.net网页时不显示treeview的原因
在.net中本地调试asp.net网页时,treeview控件显示为文字方式,原因是在http://localhost/下面找不到webctrl_client的路径,解决的方法是把webctrl_cl ...
- Spring+SpringMvc+Mybatis框架集成搭建教程五(项目源码发布到GitHub)
一.背景 我们做完了上面的四步操作以后,来把我们写好的项目提交到自己的GitHub仓库进行版本管理,具体步骤如下. 二.提交步骤 1.首先你要保证你已经有GitHub的账号和密码(没有可以去githu ...
- 利用office2010 word2010生成目录
详细内容可以从以下链接下载: http://www.360disk.com/file-37040.html 从前一直用word的目录功能,觉得很方便.第一:可以在目录的首页通过Ctrl+鼠标单击左键可 ...
- python入门一
python类型 编程语言主要从以下几个角度为进行分类,编译型和解释型.静态语言和动态语言.强类型定义语言和弱类型定义语言. 编译型和解释型 编译型:在程序执行之前,有一个单独的编译过程,将程序翻译成 ...
- C# 显示问题
- 《DSP using MATLAB》示例Example5.13
- Codeforces 717G Underfail(最小费用最大流 + AC自动机)
题目 Source http://codeforces.com/problemset/problem/717/G Description You have recently fallen throug ...
- 将一个Asp.Net网站改为MVC
背景: 网站已经开发的一部分 主要是Web服务和API 现在要做一些给人看的页面 转载请注明出处 http://www.cnblogs.com/zaiyuzhong/p/add-mvc-in-w ...
- 【Linux】unzip命令,记一次遇到的问题
最近在做BOSS系统云平台部署脚本,联调时发现Shell脚本中存在问题,下方记录 某个地方提示是否覆盖 [root@haiwai test]# unzip /home/redis/test/main- ...
- AngularJS Moudle 函数讲解
AngularJS中的Module类负责定义应用如何启动,它还可以通过声明的方式定义应用中的各个片段.我们来看看它是如何实现这些功能的. 一.Main方法在哪里 如果你是从Java或者Python编程 ...