1. 安装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就行了。

2. 修改8.0以上版本的root密码

停止mysql服务:

mysql.server stop

跳过登录方式启动并进入mysql:

sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking

如下图所示:

修改root密码:

因为现在是新版本8.0了 ,老版本的修改密码的语法已不再适用,需要使用以下方式:

mysql>use mysql;

mysql>FLUSH PRIVILEGES;

mysql>ALTER user 'root'@'localhost' IDENTIFIED BY 'newpassward'      //注意,这里的密码要用包含8位大写+小写+特殊字符+数字的密码

会提示修改密码成功!

mysql>quit;

退出mysql;

注意:原来skip-grant-tables的终端要关闭,最好在kill掉mysql进程;

然后重启mysql;

直接用mysql -u root -p 输入刚才设置的密码即可正常登录!

Mac端解决(含修改8.0.13版的密码):Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的更多相关文章

  1. 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 serv ...

  2. 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 conn ...

  3. 亲测有效,解决Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) ";

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/hjf161105/article/details/78850658 最近租了一个阿里云云翼服务器,趁 ...

  4. Mac下安装Mysql出现 Can’t connect to local MySQL server through socket '/tmp/mysql.sock'

    在Mac下安装mysql出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock' 错误,解决如下: $ unset ...

  5. Mac下Mysql启动异常["ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"]

    在mac下使用brew安装mysql,之前没有使用过,今天启动的时候发现启动不了 huijundeMacBook-Pro:bin huijunzhang$ mysql ERROR (HY000): C ...

  6. Mac - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    在终端输入mysql,结果出现 macdeMacBook-Pro:~ mac$ alias mysql=/usr/local/mysql/bin/mysql macdeMacBook-Pro:~ ma ...

  7. 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 ...

  8. 解决Can't connect to local MySQL server through socket '/tmp/mysql.sock'

    0 Problem 电脑重启后用python的MySQLdb连接数据库报错 Can't connect to local MySQL server through socket '/tmp/mysql ...

  9. mac使用brew安装mysql报RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    使用mac安装mysql安装完后运行 mysql -uroot -p 报了 ERROR 2002 (HY000): Can't connect to local MySQL server throug ...

随机推荐

  1. es6学习笔记-Proxy、Reflect、Promise

    Proxy Proxy 用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程. Proxy 可以理解成,在目标对象之前 ...

  2. react+umi+dva+antd中dva的数据流图解

  3. Python中serial的使用

    一.概述     pyserial模块封装了对串口的访问. 二.特性     在支持的平台上有统一的接口.     通过python属性访问串口设置.     支持不同的字节大小.停止位.校验位和流控 ...

  4. freemarker demo

    <!--freemarker--> <dependency> <groupId>org.springframework.boot</groupId> & ...

  5. centos安装mycat

    1.参考前文安装jdk 2.官网 http://www.mycat.io/ 或 http://dl.mycat.io/ 下载mycat 3.解压安装 cd /usr/local cp /home/ta ...

  6. the status bar issue of react-native Modal on Android ( RN v0.57.0)

    Problem: When use Modal in react-native, the status bar is not included if you make a full-screen ma ...

  7. 21. Wireless tools (无线工具 5个)

    AircrackKismetNetStumblerinSSIDerKisMAC

  8. angular1中ng-repeat效率优化方法:

    1.当 ng-repeat 的数组被替换时, 它默认并不会重新利用已有的 Dom 元素,而是直接将其全部删除并重新生成新的数组 Dom 元素: 2.Dom 的频繁操作是非常不友好的, ng-repea ...

  9. 芯灵思Sinlinx A64 Linux&qt编译安装

    开发平台 芯灵思Sinlinx A64 内存: 1GB 存储: 4GB 详细参数 https://m.tb.cn/h.3wMaSKm 开发板交流群 641395230 前提条件搭建好CentOS环境 ...

  10. python-闭包函数

    在函数编程中经常用到闭包.闭包是什么,它是怎么产生的及用来解决什么问题呢.给出字面的定义先:闭包是由函数及其相关的引用环境组合而成的实体(即:闭包=函数+引用环境)(想想Erlang的外层函数传入一个 ...