mysql当中的权限管理: mysql数据库存放的是用户配置信息表,以及mysql服务配置表 mysql当中uese表就是存放mysql用户信息表 user, host, password 重要的字段 user:用户名 host:访问权限:①本地访问,127.0.0.1或者louclhost表示本地访问权限 ②远程访问,%表示远程访问权限 update user set password=("1234567") where user="root"; flush privileges;修改成功之后记得刷新一下 user插入用户: 第一步: use mysql;进入到mysql数据库 第二步: insert into user(user,host,password)values("wuhan","localhost",password("123456")); 第三步: flush privileges;刷新 切换刚登录的用户wuhan用户,登录完成之后,发现少了好多数据库,是因为我创建用户没有配置对应的权限。 赋予权限需要用 超级用户 root 用户进行赋予权限 查询权限 :show grants show grants for "wuhan"@"localhost" usage:表示没有任何权限 all :拥有所有权限 select update insert delete 指定权限: show grants for "root"@"localhost" 赋权: select insert grant select,insert on *.* to"wuhan"@"localhost" identified by"123456"; flush privileges; 刷新 使用wuhan的用户进行数据的插入或者查询修改验证权限 有没有生效. 赋权赋值所有的权限: grant all privileges on *.*to "wuhan15"@"localhost" identified by"123456"; 创建用户同时赋权: grant all privileges on *.*to "hubei"@"localhost" identified by"123456"; grant all privileges on *.*to "root"@"%" identified by"123456";
|