• Mac下修改mysql初始密码和Windows忘记密码的处理


    修改mysql的密码有很多方式,这里是直接修改mysql 数据库里面的user表的user字段值为root对应的authentication_string字段的值步骤:1.Mac下安装好mysql后,启动mysql(系统便好设置里面启动mysql,然后Start MYSQL Server) 2.进入终端输入命令:PATH=”$PATH":/usr/local/mysql/bin 3.由于刚刚安装好的mysql密码为空,输入命令:mysql -u root -p  按回车即可登录4.显示所有数据库,输入命令:show databases;
    5.进入到名为mysql的数据库6.显示出mysql数据库里面的表, 有一个user表,里面就存储的是mysql用户名,密码7.打印user表结构8.更新authentication_string(相当于windows里面的password字段)字段,此处要用PASSWORD()函数修改至此,mysql初始密码就修改完成了,之后就可以登录试试了添加内容:
    关于Windows下面安装mysql5.6后忘记密码怎么重置的问题
    1.密码错误的时候会显示:
     mysql -uroot -p
    Enter password: 
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    2.停止服务:
    net stop mysql;
    3.进入到skip-grant-tables模式:
    mysqld safe --skip-grant-tables
    4.此时登录mysql是不会需要密码
    指令mysql就可以进入mysql数据库
    进入mysql系统数据库:
    mysql> 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
    修改root账户密码:
    mysql> update user set password=password("12345") where user="root";
    Query OK, 4 rows affected (0.02 sec)
    Rows matched: 4 Changed: 4 Warnings: 0
    刷新权限:
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    mysql> exit
    Bye
    停止mysql进程:
    Stopped mysqld safe --skip-grant-tables
    启动mysql:
    net start mysql;
    Starting MySQL SUCCESS!
    使用刚才修改的密码进入mysql:
    [root@oraserver139 ~] mysql -u root -p 12345
    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 3
    Server version: 5.6.15
    Copyright (c) 2000, 2013, 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> show databases;
    ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
    mysql> SET PASSWORD = PASSWORD('12345');
    Query OK, 0 rows affected (0.00 sec)
    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    | test |
    +--------------------+
    4 rows in set (0.00 sec)
    修改完成;

  • 相关阅读:
    jenkins操作手册——巨详细,一篇足矣
    k8s学习-CKA真题-网络策略NetworkPolicy
    【C++】多态
    线性代数的学习和整理18:什么是维度,什么是秩?秩的各种定理&&秩的计算 (计算部分未完成)
    【斯坦福计网CS144项目】Lab3: TCPSender
    《MySQL技术内幕:InnoDB存储引擎》学习笔记-第一章
    java-net-php-python-jsp学生社团信息演示录像2019计算机毕业设计程序
    MES管理系统的应用和好处有哪些
    【To .NET】C#集合类源码解析
    EFCore学习笔记(9)——实体跟踪
  • 原文地址:https://blog.csdn.net/cqn2bd2b/article/details/126809103