zoukankan      html  css  js  c++  java
  • mysql密码相关

    Q1: root密码登录不了或忘记root密码

    Answer: 在mysql配置文件(my.cnf / base.cnf)中[mysqld]下添加一行 skip_grant_tables,然后重启mysql,root用户即可无密码登录,然后设置新密码(详见Q2/Q3),再删除skip_grant_tables并重启mysql。

    ***********************************************************************
    ## v1.0 root@karl-v1:/srv/leyao/main# cat conf.d/base.cnf [mysqld] init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci query_cache_size = 64M query_cache_type = 1 join_buffer_size = 512K max_connections = 150 max_allowed_packet = 32M skip_grant_tables root@karl-v1:/srv/leyao/main#
    ************************************************************************* # v2.
    0 karl-v2 docker # cat mysql/my.cnf # The MySQL Client configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html [mysql] [mysqld] sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" character-set-server=utf8 max_allowed_packet=1048576 skip_grant_tables karl-v2 docker #

    Q2: 设置/修改root密码(v1.0)

    use mysql;
    update user set password=password("new_pwd") where user='root';
    flush privileges;
    update user set authentication_string=password('t4ecK@^y7I4CGJnwtajWuKDmAwktngth') where user='root'; #new try

    Q3: 设置/修改root密码(v2.0)

    use mysql;
    alter user 'root'@'%' identified by 'new_pwd';
    flush privileges;
  • 相关阅读:
    复利计算单元测试-软件工程
    实验一 操作系统
    <构建之法>前三章读后感—软件工程
    复利计算总结-软件工程
    实验0-操作系统
    复利计算1.0~2.0~3.0~4.0-软件工程(网页版)
    典型用户与场景
    0608场景(用户故事) 任务
    构建之法读后感+学习和诚信
    0603团队变化+sprint第二个冲刺
  • 原文地址:https://www.cnblogs.com/karl-python/p/10867686.html
Copyright © 2011-2022 走看看