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 的密码。

  • 相关阅读:
    python的函数
    Python的条件语句和循环语句
    Python的输入与输出
    Python变量和类型
    Python的运算符
    Python的注释
    pycharm基本使用
    推特史上最大规模黑客入侵案:17岁问题少年的隐秘人生
    进程和线程的区别及线程的介绍
    python接口自动化42
  • 原文地址:https://www.cnblogs.com/hellosiyu/p/12501998.html
Copyright © 2011-2022 走看看