1、打开终端,输入命令:cd /usr/local/mysql/bin

2、mysql -uroot -p,用这条命令登陆时报错信息:

报错:Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

3、打开终端输入:sudo mysqld_safe --skip-grant-tables

输出
Password:
Logging to '/usr/local/mysql/data/localhost.err'.
2018-10-10T03:21:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

4、打开一个新的终端,输入:mysql -u root ,会看到以下输出。

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.7.23 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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. mysql>

5、终端输入 use mysql显示如下

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed

6、修改密码:UPDATE mysql.user SET authentication_string=PASSWORD('你的密码') WHERE User='root';

Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1

mac中登陆mysql忘记密码解决办法的更多相关文章

  1. 十五、mac 中登陆mysql忘记密码解决办法

    mac 中登陆mysql忘记密码解决办法 1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter pa ...

  2. mac 中登陆mysql忘记密码解决办法

    1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter password: ERROR 1045 (2 ...

  3. MySQL忘记密码解决办法

    一.windows下mysql忘记root密码的解决方法 详细出处参考:http://www.jb51.net/article/21984.htm 1,停止MYSQL服务,CMD打开DOS窗口,输入 ...

  4. mac mysql忘记密码解决办法

    http://www.jb51.net/article/87580.htm http://blog.csdn.net/soft2buy/article/details/50223373

  5. MySQL 忘记密码解决办法

    第一步: 关闭MySQL服务.  第二步: 打开DOS窗口,在里面输入安装MqSQL的目录本机为:C:\Program Files\MySQL\MySQL Server 5.6\bin 第三步: 在命 ...

  6. mysql忘记密码解决的办法

    [很管用]忘记mysql root密码解决办法 1.编辑MySQL配置文件: 首先停止mysql服务, 然后开始编辑mysql配置文件:vi /etc/my.cnf在[mysqld]配置段添加如下一行 ...

  7. CentOS忘记mariadb/mysql root密码解决办法

    本文不再更新,可能存在内容过时的情况,实时更新请访问原地址:CentOS忘记mariadb/mysql root密码解决办法: 这里有两种方式实现修改mariadb root密码. mariadb版本 ...

  8. CentOS 6忘记密码解决办法,root和普通用户均可

    转自nui111的文章:http://blog.csdn.net/nui111/article/details/28007357 说明 操作系统:CentOS 6.0 遇到问题:忘记管理员账号root ...

  9. MAC下的mysql忘记密码该怎么办??

    不要着急,不要慌,好多人会忙手忙脚,以为自己安装了一个假软件,其实是你打开的方式不对而已! step1: 苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务(点击 ...

随机推荐

  1. apache禁止默认虚拟主机

    禁止默认虚拟主机:作用使除特定域名外,其它的域名/ip无法访问此站点. 在虚拟主机配置文件中 即:/usr/local/apache2/conf/extra/httpd-vhosts.conf 将其中 ...

  2. 2019-03-19 Fiori学习笔记 Fiori开发环境

    Fiori 文档 :https://experience.sap.com/fiori-design-web/ Fiori 登录:https://cloudplatform.sap.com/index. ...

  3. OpenCL32 for mingw

    OpenCL32 for MinGW 最新版本 2019.05.25 从 CUDA_Toolkit_10.1.168_425.25_win10 中提取的头文件和库文件: 链接: https://pan ...

  4. oracle系统视图V$

    --数据字典表select * from v$fixed_table;select * from v$fixed_view_definition;select * from dictionary; - ...

  5. squid代理使用yum源

    参考文档:https://blog.csdn.net/tuolaji8/article/details/73613859https://www.centos.bz/2017/10/centos-7%E ...

  6. GO——beego安装及新建项目(一)

    beego简介 Beego是一个快速开发Go应用的http框架,可用于快速开发Api.web及后端服务等各种应用,是一个RESTful框架. beego的架构 Beego由八个独立模块构建,是一个高度 ...

  7. C++编译错误提示 [Error] name lookup of 'i' changed for ISO '

    在VC 6 中,i的作用域范围是函数作用域,在for循环外仍能使用变量i 即: for (int i = 0; i < n; ++i) {         //…… } cout<< ...

  8. 安装opencv3.3.0碰到的问题及解决方法

    出处:http://osask.cn/front/ask/view/258965 CMakeError.log Compilation failed: source file: '/home/jhro ...

  9. 平衡树(fhq无旋treap)

    fhq板子(代码正确且风格易懂) 洛谷P3369 #include<iostream> #include<cstring> #include<cstdio> #in ...

  10. SpringMvc 整合mybatis项目搭建

    1.使用idea创建maven项目 2.在项目src目录下 添加java文件夹 并设置类型为sources,添加resource文件夹 设置为resources 4.修改pom文件 添加引用 < ...