您的位置:首页 > 博客中心 > 数据库 >

linux中MySQL下添加用户以及给予权限的实现

时间:2022-03-14 01:01

1、在linux中首先登入mysql:mysql -u root -p(提示输入密码,输入即可) 

2、选择mysql数据库:use mysql。

   在mysql表中插入系统的用户名和用户密码:

insert into user(Host,User,Password) values("localhost","你的用户名",password("你要设置的密码"));

3、刷新mysql系统相关的表:flush privileges;

4、给新增的用户添加管理数据库的所有权限:

grant all on 数据库.数据库表(用*表示对应数据库下面所有的表格) to 用户名称;


备忘录:

grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;

是指用户joe能够从ip为10.163.225.87的主机上使用密码123来登录并对数据库vtdc对应的表employee实行 select,insert,update,delete,create,drop操作。

ip地址可以自由限制,或者不限制就改为*。

权限都有select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file14个权限,当要所有的权限是直接改为grant all privileges on



热门排行

今日推荐

热门手游