#mysql常用sql语句

版权声明:知识需要共享与交流 https://blog.csdn.net/weixin_43450987/article/details/85403519

一、mysql8.0中的用户创建及权限分配

#创建用户,并初始化密码
create user 'test'@'%' identified WITH mysql_native_password by 'test1254S!';
#创建一个新的数据库
create database testDB;
#授权test用户拥有testDB数据库的所有权限(某个数据库的所有权限):
grant all privileges on testDB.* to 'test'@'%';
#刷新系统权限表
flush privileges;

#如果想指定部分权限给一用户,可以这样来写:
grant select,update on testDB.* to test@localhost identified by '1234';
#刷新系统权限表
flush privileges;

猜你喜欢

转载自blog.csdn.net/weixin_43450987/article/details/85403519