zoukankan      html  css  js  c++  java
  • mysql用户管理

    1 用户创建

    创建user1用户,只能在localhost这个服务器登录mysql服务器,密码123

    create user 'user1'@'localhost' identified by '123';
    

    创建user2用户,可以在任意服务器登录mysql服务器,密码123

    create user 'user2'@'%' identified by '123';
    

    创建的用户在mysql 数据库 user表中

    2 用户授权与撤销

    给user1用户分配对test数据库操作权限:创建表,修改表,插入更新查询

    grant create,alter,insert,update,select on test.* to 'user1'@'localhost';
    

    user2分配所有权限

    grant all on *.* to 'user2'@'%';
    

    撤销user1用户对test数据库所有权限

    revoke all on test.* from 'user1'@'localhost';
    

    查看权限、

    show grants for 'user2'@'%';
    

    删除用户

    drop user 'user1'@'localhost';
    

    修改管理员root密码为123

    mysqladmin -uroot -p password 123
    

    修改普通用户密码

    set password for 'user1'@'localhost'=password('123456');
    

    Navicat无法连接数据库的解决办法

    打开【win+r】输入CMD进入命令行界面,然后输入

    alter user 'root'@'localhost' identified by '密码' password expire never;

    alter user 'root'@'localhost' identified with mysql_native_password by '密码';

    flush privileges;

    记得将密码替换为mysql 的密码。

  • 相关阅读:
    Ajax学习总结
    从零开始学Docker
    IBM Websphere MQ常用命令及常见错误
    Log4j学习总结
    Eclipse中各图标含义
    类加载机制与反射
    Feign【入门】
    Eureka【故障演练分析】
    Eureka【启用https】
    Eureka【开启http basic权限认证】
  • 原文地址:https://www.cnblogs.com/hellosiyu/p/12501998.html
Copyright © 2011-2022 走看看