linux(ubuntu) 1045, "Access denied for user 'root'@'localhost' (using password: YES)"
问题现象:
最近使用 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)"的更多相关文章
- windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案
win7 MySql5.6.17提示:1045 access denied for user 'root'@'localhost' using password yes 从网上找到的解决方法,以此博客 ...
- phpmyadmin #1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpmyadmin访问遇到1045问题 #1045 - Access denied for user 'root'@'localhost' (using password: NO) 解决办法 找到p ...
- Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes
Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes http://blog.csdn.n ...
- 1045 access denied for user 'root'@'localhost' using password yes的解决方法
今天把一个项目和项目的数据库都下载到了本地,安装好项目和在本地配置好数据库后,在浏览器登陆项目的后台却出现了以下错误: 后来上百度搜索了好几个答案,都是讲述修改数据库密码的步骤,但是就是没有说明为 ...
- wamp中的phpmyadmin打开出现:#1045 - Access denied for user 'root'@'localhost' (using password: NO)
详细内容: MySQL said: #1045 - Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin ...
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)(转)
前两天也偶尔出现这个错误,也没在意,因为我重新修改一下mysql的root密码后又可以用了,但昨天却不行,我把root密码修改以后虽然当时能用, 一旦重新进入就都不能用了,可我的密码明明没有错啊?今天 ...
- CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
连接mysql出错:CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for u ...
- 错误代码1045 Access denied for user 'root'@'localhost' (using password:YES)
在mysql中新建连接,ip地址是127.0.0.1,账号是root,密码是123456,但是测试连接的时候报错, 错误代码1045 Access denied for user 'root'@'lo ...
- 新手PHP连接MySQL数据库出问题(Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES))
我用的环境是wampServer集成的软件包 在php连接MySQL数据库的时候老是出现这个问题Warning: mysqli_connect(): (HY000/1045): Access deni ...
随机推荐
- [GitHub] 75+的 C# 数据结构和算法实现
C#中标准数据结构和算法的即插即用类库项目 GitHub:https://github.com/aalhour/C-Sharp-Algorithms Watch: 307 Star: 3.4k For ...
- MySQL笔记总结-DDL语言
DDL语言 数据类型 一.数值型 1.整型 tinyint.smallint.mediumint.int/integer.bigint 1 2 3 4 8 特点: ①都可以设置无符号和有符号,默认有符 ...
- py安装教程
https://www.runoob.com/w3cnote/pycharm-windows-install.html
- php 全局变量和超全局变量
global 全局变量(在当前页面全部地方有效) $GLOBALS['name'] 超全局变量(在整个网站全部地方有效) 一个包含了全部变量的全局组合数组.变量的名字就是数组的键.还有_GET,_PO ...
- urlencode()和rawurlencode()区别
urlencode和rawurlencode两个方法在处理字母数字,特殊符号,中文的时候结果都是一样的 ,唯一的不同是对空格的处理, urlencode处理成“+”, rawurlencod ...
- libeay32.dll 1.0.2j crash
https://github.com/BOINC/boinc/issues/2470 他们认为是CPU不同造成的 另外一个可能的原因 Changes between 1.0.2j and 1.0.2k ...
- tagbar 调到函数定义再跳回
首先要在源码文件夹下执行 ctags -R * 生成tags文件 齐次要安装 YouCompleteMe ctrl + ] 跳到函数定义 Ctrl-o 和 Ctrl-I 跳回.我试验的只有 Ctrl- ...
- AjaxControlToolkit的安装步骤
1.下载: 下载地址:http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx 打开网址后找到这些: AjaxC ...
- Scala教程之:Either
在之前的文章中我们提到了Option,scala中Option表示存在0或者1个元素,如果在处理异常的时候Option就会有很大的限制,因为Option如果返回None,那么我并不知道具体的异常到底是 ...
- 已有项目接入git远程仓库
1.项目根目录初始化git仓库 git init 2.将本地项目与远程仓库关联(首先得在远程创建一个代码仓库) git remote add origin 远程仓库地址 诺,仓库地址就是这个玩意 3. ...