解决在anaconda下使用pymysql连接数据库MySQL时出现的一个问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/HQ1356466973/article/details/80510474

问题描述:

pymysql.err.OperationalError: (1045, "Access denied for user 'mel'@'localhost' (using password: NO)")

 db = pymysql.connect(host="localhost",user="mel",passwd="2015201315",db="db_test",port=3306)

解决方法方法是,在命令行登录MySQL数据库,然后输入

 alter user '用户名'@localhost identified with mysql_native_password by '用户密码';


如上述的用户名对应问题中的‘mel’

猜你喜欢

转载自blog.csdn.net/HQ1356466973/article/details/80510474
今日推荐