首页 / UBUNTU / linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"
linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)",小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1184字,纯文字阅读大概需要2分钟。
内容图文
最近使用 flask 的 sqlalchemy 框架,在链接数据库(mysql)时出现报错
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user ‘root‘@‘localhost‘ (using password: YES)") (Background on this error at: http://sqlalche.me/e/e3q8)
直接在终端输入 mysql 也会出现报错
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
但是使用 mysql -uroot -p 可以正常进入数据库
解决方法:
我的系统为 ubuntu
修改文件
/etc/mysql/mysql.conf.d/mysqld.cnf
找到 [mysqld]
添加配置:
skip-grant-tables
保存后重启服务
/etc/init.d/mysql restart
此时报错都被解决掉了 直接输入 mysql 即可进入数据库
如果是自己测试或者练手小项目就可以继续了,但是此方式存在安全隐患,会跳过权限验证,如果对安全有要求的需要进入数据库修改密码后将此配置去掉后重启
use mysql; update user set password=password("你的新密码") where user="root";
linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"
标签:去掉 com mysql flask this mys start font span
本文系统来源:https://www.cnblogs.com/chestnut-egg/p/10472324.html
内容总结
以上是互联网集市为您收集整理的linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"全部内容,希望文章能够帮你解决linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。