TemplatePro/BZPT.Api/mysqpws.txt

35 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ALTER USER 'root'@'localhost' IDENTIFIED BY '2S_#%~aB4&2.23';
//只允许指定ip连接
create user 'efour'@'%' identified by '223@.WWR@lwb*&';
grant all privileges on *.* to 'efour'@'%' identified by '223@.WWR@lwb*&' WITH GRANT OPTION;
alter user 'efour'@'%' identified by '223@.WWR@lwb*&';
grant all privileges on meirong1.* to efour;
flush privileges;
//允许所有ip连接用通配符%表示223@.WWR@lwb*&
create user '新用户名'@'%' identified by '密码';
5、为新用户授权
//基本格式如下
grant all privileges on 数据库名.表名 to '新用户名'@'指定ip' identified by '新用户密码' ;
//示例
//允许访问所有数据库下的所有表
grant all privileges on *.* to '新用户名'@'指定ip' identified by '新用户密码' ;
//指定数据库下的指定表
grant all privileges on test.test to '新用户名'@'指定ip' identified by '新用户密码' ;
6、设置用户操作权限
//设置用户拥有所有权限也就是管理员
grant all privileges on *.* to '新用户名'@'指定ip' identified by '新用户密码' WITH GRANT OPTION;
//拥有查询权限
grant select on *.* to '新用户名'@'指定ip' identified by '新用户密码' WITH GRANT OPTION;
//其它操作权限说明,select查询 insert插入 delete删除 update修改
//设置用户拥有查询插入的权限
grant select,insert on *.* to '新用户名'@'指定ip' identified by '新用户密码' WITH GRANT OPTION;
//取消用户查询的查询权限
REVOKE select ON what FROM '新用户名';