IT 分析:足迹第一百步:Mysql创建用户并赋予用户对数据库的全部权限
- 1)Mysql5.7创建用户并赋予用户对数据库的全部权限
- 2)MySQL8.0创建用户并授权的命令
1)Mysql5.7创建用户并赋予用户对数据库的全部权限
#建新用户user,新用户密码为PASSword123.
create user "user"@"localhost"identified by 'PASSword123.';
#赋予用户对数据库wordpress的全部权限
grant all privileges on wordpress.* to 'user'@'localhost' identified by 'PASSword123.';
#使配置生效。
flush privileges;
#退出MySQL。
exit;
2)MySQL8.0创建用户并授权的命令
mysql>create user dongxt@'%' identified by 'password';
mysql>grant all privileges on *.* to dongxt@'%' with grant option;
mysql>flush privileges;
mysql>alter user dongxt@'%' identified with mysql_native_password by 'password';