mysql -u root -p
use mysql;
#创建用户并允许所有ip访问,%可替换为localhost
create user 'root'@'%' identified by 'password'
#赋予权限
grant all privileges on *.* to 'root'@'%' with grant option;
#使上述语句生效
flush privileges;
#查询下是否有用户,并看下密码规则