grant all on *.*
grant 权限 on 数据库.表 to 用户@'ip地址' identified by '密码';
刷新授权表 flush privileges
csh.qtf
csh.*
grant all on *.* to user1@'192.168.1.%' identified by '密码';
grant select on *.* to user1@'192.168.1.%' identified by '密码';
grant select,insert,delete,update on *.* user1@'192.168.1.%' identified by '密码';
修改用户密码:
mysql> update user set password=password('123456') where user='root';
查看用户信息
use mysql
select User,Host,Password from user; #查看用户信息
show grants for 用户@'ip地址'; #查看授权信息
grant all on *.*
grant 权限 on 数据库.表 to 用户@'ip地址' identified by '密码';
刷新授权表 flush privileges
csh.qtf
csh.*
grant all on *.* to user1@'192.168.1.%' identified by '密码';
grant select on *.* to user1@'192.168.1.%' identified by '密码';
grant select,insert,delete,update on *.* user1@'192.168.1.%' identified by '密码';
查看用户信息
use mysql
select User,Host,Password from user; #查看用户信息
show grants for 用户@'ip地址'; #查看授权信息
revoke 权限 on *.* from user1@'192.168.1.%';
revoke select,insert,delete,update on *.* from user1@'192.168.1.%';
flush privileges;
show grants for user1@'192.168.1.%';
revoke SELECT, INSERT ON `csh`.* from 'cshuser'@'192.168.31.9' ;
删除无效用户;
select user,host from user;查询用户
delete from user where User='user1';
mysql -u用户 -p密码
show databases;
use 数据库名;
例如: use mysql;
desc user;
mysql> grant select on usvn.* to usvnuser@'192.168.2.251' identified by 'usersvnpwd';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)