zoukankan      html  css  js  c++  java
  • Mysql5.7.13忘记密码及创建用户

    mysql 5.7.13重置root密码:
    1.my.nin文件里在 [mysqld]下增加skip-grant-tables
    2.cmd:net start mysql -mysql -use mysql; -UPDATE user SET authentication_string=PASSWORD(NEWPASSWORD) WHERE User=root; -FLUSH PRIVILEGES; -quit;
    3.登陆
    mysql 5.7.13重置root密码:
    
    
    1.my.nin文件里在 [mysqld]下增加“skip-grant-tables”
    2.cmd:net start mysql
    ->mysql
    ->use mysql;
    ->UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    ->FLUSH PRIVILEGES;
    ->quit;
    3.登陆时,将my.min文件里的“skip-grant-tables”删除
    登陆mysql -u用户 -p密码;
    
    如果登陆进去报错1820,
    登陆mysql -u -p 进去:输入mysql> SET PASSWORD = PASSWORD('123456');
    
     
    
    创建用户:
    create user yzkj;
    update user set authentication_string=password("123456") where user="yzkj";
    grant all on hzx.* to 'yzkj'@'localhost';
    
    create user text;
    update user set authentication_string=password("123456") where user="text";
    grant all on text.* to 'text'@'localhost';
    
    3.刷新数据库 (一定要记得刷新)
    mysql>flush privileges; 
    quit
    mysql -uyzkj -p
    123456
    成功!
    

      

     
     
  • 相关阅读:
    164-268. 丢失的数字
    163-20. 有效的括号
    Sword 30
    Sword 29
    Sword 27
    Sword 25
    Sword 24
    Sword 22
    Sword 21
    Sword 18
  • 原文地址:https://www.cnblogs.com/Easonlou/p/6646848.html
Copyright © 2011-2022 走看看