1.创建用户

create user 'username'@'localhost' identified by 'pwd'

2.修改访问权限

在mysql数据下修改user表用户host为’%’

update user set host='%' where user='username'

3.修改密码

MYSQL8.0密码默认加密方式为 default_authentication_plugin=caching_sha2_password 所以会造成不兼容问题

alter user 'username'@'localhost' identified with mysql_native_password by 'newpwd'

4.修改操作权限

MYSQL 8.0不支持创建用户时授权,必须先创建,后授权

grant all privileges on *.* to 'username'@'%' with grant option;