找了半天

又是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. flask(列表数据接口设计)

    新闻列表数据只是当前页面的一部分 点击分类时需要去获取当前分类下的新闻数据 并在展示的时候需要更新新闻列表界面,不需要整体页面刷新 所以新闻数据也使用 ajax 的方式去请求后台接口进行获取 接口设计 ...

  2. python教程(一)·命令行基本操作

    先来了解下 "命令提示符". 等等?!既然本篇文章标题是"命令行基本操作",那怎么又说到"命令提示符"去了呢?客官莫要急,且听我说 命令提示 ...

  3. java 代理模式(模拟代购)

    interface Isubject{ void buyAJ(); } class realsubject implements Isubject{ public void buyAJ(){ Syst ...

  4. Numpy 01

    Infi-chu: http://www.cnblogs.com/Infi-chu/ import numpy as np # 创建的数组 stus_score = np.array([[80, 88 ...

  5. 将 List<Obj> 集合, 导出至 Excel

    主代码在这:http://www.codeproject.com/Articles/120480/Export-to-Excel-Functionality-in-WPF-DataGrid 黑人老外写 ...

  6. Ajax跨域请求怎么解决?

    前言 项目中需要将第三方系统中,对应用户的代办消息集成到系统中.对方提供了获取对应用户的接口url,但是由于两边的系统是部署到客户现场不同IP的虚机上的,所以进行ajax请求的时候是属于跨域请求的.之 ...

  7. Java:内存泄露和内存溢出

    1. 内存溢出 (Memory Overflow) 是指程序在申请内存时,没有足够的内存空间供其使用,出现out of memory:比如申请了一个integer,但给它存了long才能存下的数,那就 ...

  8. onenet基础通信套件加B300移植

    1. 遇到的第一个问题,说是少了文件,但是明明有这个文件的啊? scons: warning: Ignoring missing SConscript 'build_scons\arm\Hi2115\ ...

  9. python import vs from import

    https://stackoverflow.com/questions/9439480/from-import-vs-import

  10. python generator

    def reverse(data): for index in range(len(data)-1, -1, -1): yield data[index] for char in reverse('g ...