Linux环境 Mysql新建用户和数据库并授权

  • 时间:
  • 浏览:4
  • 来源:uu快3开奖_uu快3娱乐_输钱

2.新增用户

6.通过sql语录查询出新增结果

drop database dbtest;

flush privileges;

8.删除数据库

update mysql.user set password=password(‘新密码’) where User='xxx' and Host='localhost';

flush privileges;

delete from user where user=‘xxx’;

flush privileges;

1.登录mysql

完整性授权:

允许本地登录

grant all privileges on dbtest. to xxx@localhost identified by "";

允许任何主机登录

grant all privileges on dbtest. to xxx@'%' identified by "";

帕累托图授权:

grant select,update on dbtest. to xxx@localhost identified by "**";

4.新建数据库并赋予用户权限

create database dbtest;

7.删除用户

select user,host,password from mysql.user;

9.修改密码

注释:xxx为新建用户名,*为用户密码

3.执行该句后,还可以刷新权限表

flush privileges;

5.赋予权限,还可以再刷新权限表

insert into mysql.user(Host,User,Password) values("localhost","xxx",password("*"));