create创建的用户,只有usage权限,即,连接数据库的权限,最低的权限。
# 1、新建用户,这里的用户是由user_name 和ip一起唯一确定一个用户。
# 2、若省略ip表达式,则表示%,即所有主机。
# 3、不能创建重复的用户,
# 创建用户
create user 用户名@'主机或ip表达式' identified by '密码';
create user username identified by '123456';
create user username@'localhost' identified by '123456';
create user username@'igoodful.com' identified by '123456';
create user username@'%.com' identified by '123456';
create user username@'127.0.0.1' identified by '123456';
create user username@'10.10.%' identified by '123456';
#########################################################
# 删除用户
drop user username@'localhost';
drop user username@'127.0.0.1';
drop user username@'10.10.%';
#########################################################
# 修改用户
rename user username_old@'10.%' to username_new@'10.10.10.10';