找了半天

又是kill进程,又是改设置文件,又是重启电脑,都不管用

翻到stackoverflow上的解决方案,实施成功:

原文链接:https://stackoverflow.com/questions/13480170/access-denied-for-mysql-error-1045

To restore it:

Stop mysqld deamons.

$ sudo service mysqld stop

Go to mysql/bin directory

$ cd /usr/bin

Start a mysql deamon with this option:

$ sudo mysqld_safe --skip-grant-tables

Open another terminal and open a mysql session to execute this:

$ mysql

mysql> use mysql;

see Note1 below for next line.
mysql> UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD_HERE') WHERE user = 'root'; mysql> exit;

Now kill the mysqld_safe process and restart mysqld normally:

$ sudo service mysqld start

Note1: password is the column name in table mysql.user prior to version 5.7. After which it became authentication_string. Change your update statement accordingly.

有坑请注意:

1. 第一句“sudo service mysqld stop” 我电脑提示service: command not found,但是不执行这句好像也没什么关系

2.Note部分,password关键词在新版里已修改为authentication_string

感恩作者。

 

mac mysql连接报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的更多相关文章

  1. 解决mysql登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题

    问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...

  2. 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...

  3. mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))

    mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...

  4. 【转载】重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor ...

  5. mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    原文链接:http://blog.csdn.net/kuluzs/article/details/51924086 [问题]:mysql版本:5.7.13 首次在centos下安装MySQL,客户端连 ...

  6. 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    出现报错: Warning: World-writable config file '/etc/my.cnf' is ignored // 该文件权限过高ERROR 1045 (28000): Acc ...

  7. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  8. centos7 上安装mysql5.7后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Yes 或者No)

    原文转载自以下链接:https://blog.csdn.net/keepd/article/details/77151006 安装完mysql后会有个临时密码去日志查看,但是查看登录修改密后还是不行 ...

  9. CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法

    1.停用mysql服务:# /etc/rc.d/init.d/mysqld stop 2.输入命令:# mysqld_safe --user=mysql --skip-grant-tables --s ...

随机推荐

  1. day 16 初试面试对象

    1.初识面向对象      面向过程:             一切以事物的发展流程为中心      面向对象:             一切以对象为中心.一切皆为对象.具体的某一个事务就是对象 打比 ...

  2. Java常用容器对比

    ArrayList与Vector ArrayList和Vector内部都是由数组实现的,数组实现的优点就是支持元素的随机访问(O(1)),但是在对元素进行插入和删除操作时,需要向后或向前移动数组,这样 ...

  3. go学习笔记-反射(Reflection)

    反射(Reflection) 反射是利用reflect包实现的 反射可大大提高程序的灵活性,使得interface{}有更大的发挥余地 反射使用TypeOf和ValueOf函数从接口中获取目标对象信息 ...

  4. 12-oauth密码模式identity server4实现

    1-服务端代码, 配置类,可加 RequireClientSecret=false, 这样调用端就不需要传入client_secret参数 using System.Collections; usin ...

  5. FpSpread基本句法

    1,   在调用的.aspx页面开头注册:     "FarPoint.Web.Spread"   Assembly="FarPoint.Web.SpreadJ,   V ...

  6. Manual install on Windows 7 with Apache and MySQL

    These are instructions for installing on Windows 7 desktop (they may also be useful for a server ins ...

  7. 「日常训练」Uncle Tom's Inherited Land*(HDU-1507)

    题意与分析 题意是这样的:给你一个\(N\times M\)的图,其中有一些点不能放置\(1\times 2\)大小的矩形,矩形可以横着放可以竖着放,问剩下的格子中,最多能够放多少个矩形. 注意到是\ ...

  8. Centos 7 快速安装 Docker

    摘要: 安装 Docker [root@localhost~]# yum install docker 启动 docker 服务 [root@localhost~]# systemctl start ...

  9. Python拼接字符串的7种方法

    1.直接通过+操作: s = 'Python'+','+'你好'+'!'print(s) 打印结果: Python,你好! 2.通过join()方法拼接: 将列表转换成字符串 strlist=['Py ...

  10. Java应用基础微专业-入门篇

    第1章--用程序来做计算 1.1 第一个Java程序 Mac version: Preference -> General -> Keys -> Search "Conte ...