ubuntu下用pycharm连接MySQL8.0失败

img

  1. MySQL可以在命令窗口登录

  2. 数据库驱动也没有问题

  3. 输入密码后测试连接,密码消失,弹出窗口,报错1045

create user pyuser@localhost identified with mysql_native_password by 'LaoGeDB123!';
grant all on . to pyuser@localhost ;
执行这两条命令,创建一个用mysql_native_password验证的新用户pyuser,密码是LaoGeDB123!,再用它登录。密码可以换成你自己的,注意复杂度要满足。