第一步:CREATE USER username IDENTIFIED BY '123456' ;
//创建用户
第二步:GRANT ALL PRIVILEGES ON `case`.* TO 'username'@'192.168.78.24'IDENTIFIED BY '123456' WITH GRANT OPTION;
//授权远程ip192.168.78.24可以访问
第三步:FLUSH PRIVILEGES ;
//刷新
创建数据库:
create database ljj default character set utf8;
第二种:
select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
bin>mysql -u root
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
grant select,insert,update,delete,create,drop on phone to admin@192.168.78.152 identified by "admin";
//开放管理MySQL中所有数据库的权限
grant all on *.* to 用户名@'IP地址' identified by"密码";
//回收权限
revoke all on *.* from ad@localhost;
//查看MySQL用户权限
show grants;
show grants for ad@localhost;
//开放管理MySQL中具体数据库的表(test.table1)的部分列的权限
grant select(id,se,rank) on test.table1 to ad@'192.168.0.10'identified by "ad_pass";
//创建用户
第二步:GRANT ALL PRIVILEGES ON `case`.* TO 'username'@'192.168.78.24'IDENTIFIED BY '123456' WITH GRANT OPTION;
//授权远程ip192.168.78.24可以访问
第三步:FLUSH PRIVILEGES ;
//刷新
创建数据库:
create database ljj default character set utf8;
第二种:
select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
bin>mysql -u root
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
grant select,insert,update,delete,create,drop on phone to admin@192.168.78.152 identified by "admin";
//开放管理MySQL中所有数据库的权限
grant all on *.* to 用户名@'IP地址' identified by"密码";
//回收权限
revoke all on *.* from ad@localhost;
//查看MySQL用户权限
show grants;
show grants for ad@localhost;
//开放管理MySQL中具体数据库的表(test.table1)的部分列的权限
grant select(id,se,rank) on test.table1 to ad@'192.168.0.10'identified by "ad_pass";