create user zhang@localhost identified by "123456"; 创建用户
用户名是zhang, 密码是123456,主机名是localhost,只能从localhost访问数据库
create user zhang@“192.168.1.%” identified by "123456"; 创建用户
192.168.1.* 的主机可以访问
drop user username@hostname; 删除用户
ubuntu上安装好mysql后端口默认绑定在127.0.0.1上别的主机不能访问,改为0.0.0.0
修改用户名为fuchengyuan 的host为223.250.%.%
update mysql.user set host='223.250.%.%' where user='fuchengyuan';
show databases;select host, user, password from user;
修改用户访问指定数据库的权限:
grant all on jinshan to 'fuchengyuan'@'223.249.%.%';
显示用户的权限
show grants for fuchengyuan@"%";