Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/my
Posted sym3099@gmail
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/my相关的知识,希望对你有一定的参考价值。
我的环境: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
参考文章: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
[[email protected] ~]#
[[email protected] ~]# 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)
[[email protected] ~]#
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.
以上是关于Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/my的主要内容,如果未能解决你的问题,请参考以下文章
Mac mySql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/my
mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock&
mac使用brew安装mysql报RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp
长久不用的mysql报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys