1. 介绍
小于 1 分钟
1. 介绍
1. 密码
1. 创建
create user 'userName'@'192.168.0.%' identified by 'newPassword';
grant all on *.* to 'userName'@'192.168.0.%';
2. 修改
alter user userName@'ip' identified by 'newPassword';
SET PASSWORD FOR userName@'ip' = PASSWORD('newPassword');
SET PASSWORD = password('newPassword'); # 只是修改了当前用户的当前链接方式
update user set PASSWORD = password('newPassword'); # 修改当前用户所有连接方式的密码;方式太粗暴,不建议用
# 用户不存在则会创建
grant all on *.* to 'userName'@'localhost' identified by '123456';
# 终端方式修改的管理员密码
mysqladmin -uroot -p password newpassowrd