mysql如何让一个用户同时管理多个数据库

mysql如何让一个用户同时管理多个数据库,第1张

mysql 创建一个用户 hail,密码 hail,指定一个数据库 haildb 给 hail

mysql -u root -p

password

use mysql

insert into user(host,user,password) values('localhost','hail',password('hail'))

flush privileges

create database haildb

grant all privileges on haildb.* to hail@localhost identified by 'hail'

flush privileges

如果想指定部分权限给用户

grant select,update on haildb.* to hail@localhost identified by 'hail'

flush privileges

删除用户

delete from user where user='hail' and host='localhost'

flush privileges

删除用户数据库

drop database haildb

修改指定用户密码

update user set password=password('new_password') where user='hail' and host='localhost'

flush privileges

mysql 创建一个用户 hail,密码 hail,指定一个数据库 haildb 给 hail

mysql -u root -p

password

use mysql

insert into user(host,user,password) values('localhost','hail',password('hail'))

flush privileges

create database haildb

grant all privileges on haildb.* to hail@localhost identified by 'hail'

flush privileges

如果想指定部分权限给用户

grant select,update on haildb.* to hail@localhost identified by 'hail'

flush privileges

删除用户

delete from user where user='hail' and host='localhost'

flush privileges

删除用户数据库

drop database haildb

修改指定用户密码

update user set password=password('new_password') where user='hail' and host='localhost'

flush privileges


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/6670602.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-26
下一篇 2023-03-26

发表评论

登录后才能评论

评论列表(0条)

保存