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

  • 时间:
  • 浏览:2
  • 来源:UU快3—全天最准大发快三

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

2.新增用户

7.删除用户

9.修改密码

flush privileges;

8.删除数据库

全部授权:

允许本地登录

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 "**";

delete from user where user=‘xxx’;

flush privileges;

drop database dbtest;

6.通过sql励志的话 查询出新增结果

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

flush privileges;

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

1.登录mysql

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

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

flush privileges;

select user,host,password from mysql.user;

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

create database dbtest;