本篇文章就教大家一个简单的建立数据库和权限分配的教程。
(1)新建一个数据库 travel_db
CREATE DATABASE `travel_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
(2)新建一个用户 travelUser1,只允许该用户 访问 travel_db 库
create user `travelUser1`;
update mysql.user set password=password('pwd123#.O') where User='travelUser1';
flush privileges;
show grants for `travelUser1`;
grant select,update,delete,insert on travel_db.* to `travelUser1`;
flush privileges;
show grants for `travelUser1`;
(3)设置 rijiAppUser 能够对 travel_db 库进行所有操作
flush privileges;
grant all on travel_db.* to `travelUser1`;
show grants for `travelUser1`;
怎么样是不是很简单,初学的小伙伴们可以动手试一试哦。
相关推荐:
以上就是简单的数据库权限分配教程的详细内容,更多请关注php中文网其它相关文章!
……