mysql 添加远程用户并赋权

为用户授权

远程用户

mysql>   grant all privileges on *.* to lz@'%' identified by '1111111';
Query OK, 0 rows affected (0.00 sec)
 本地用户
mysql> grant all privileges on *.* to lz@localhost identified by '1111111';
Query OK, 0 rows affected (0.00 sec)
 
授予部分权限
grant select,update on testDB .* to test@localhost identified by '1234';

刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


格式: grant all privileges on *.* to 用户名@'%允许任何ip 或者指定IP地址' identified by '密码';


你可能感兴趣的:(mysql)