1045 access denied for user 'root'@'localhost' using password yes的解决方法
今天把一个项目和项目的数据库都下载到了本地,安装好项目和在本地配置好数据库后,在浏览器登陆项目的后台却出现了以下错误:

后来上百度搜索了好几个答案,都是讲述修改数据库密码的步骤,但是就是没有说明为什么要修改密码,修改密码为‘123456’后,打开数据库却给我弹出以下错误:

出现以上这个‘1045 - Access denied for user 'root'@'localhost'(using password NO)’错误是因为修改数据库密码为‘123456’后,连接数据库的时候没有把新密码‘123456’填上,后来填上后即可连接!
之所以出现第一个错误:‘1045 - Access denied for user 'root'@'localhost'(using password YES)’的原因是我下载到本地的那个项目的数据库配置文件中数据库密码是‘123456’,而我当时本地数据库密码为空;
综上所述,数据库配置信息必须要与其所相连接的数据库配置信息一致!
修改数据库密码步骤如下:
1:进入cmd,停止mysql服务:
Net stop mysql
到mysql的安装路径启动mysql,在bin目录下使用mysqld-nt.exe启动,
2:执行:mysqld-nt --skip-grant-tables(窗口会一直停止)
3:然后另外打开一个命入令行窗口,执行mysql(或者直接进Mysql Command Line Cilent),此时无需输入密码即可进入。
>use mysql
>update user set password=password("新密码") where user="root";
>flush privileges;
>exit
4:使用任务管理器,找到mysqld-nt的进程,结束进程!
在重新启动mysql-nt服务,就可以用新密码登录了
附:修改数据库密码的另外一种方式:
update mysql.user set password=PASSWORD('mysql56') where user='root';
1045 access denied for user 'root'@'localhost' using password yes的解决方法的更多相关文章
- wamp出现问题#1045 - Access denied for user 'root'@'localhost' (using password: NO)的解决方法
打开wamp->apps->phpmyadmin目录下面的config.inc.php文件 cfg['Servers'][$i]['verbose'] = 'localhost';$cfg ...
- 远程连接Linux mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
在新安装好的Centos7上刚安装好mysql,准备进去看看,但是登陆的时候,发现报错啦: ERROR 1045 (28000): Access denied for user 'root'@'loc ...
- mac os x 安装mysql遇到 Access denied for user 'root'@'localhost' (using password: YES)的解决方法
最近把开发环境迁移到macbook上,装上mysql启动之后,连接,总是报这个错误.5.5的版本默认密码为空.其实这个错误是root未授权的问题.解决方法如下: 未给localhost root用户授 ...
- CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法
1.停用mysql服务:# /etc/rc.d/init.d/mysqld stop 2.输入命令:# mysqld_safe --user=mysql --skip-grant-tables --s ...
- Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
https://www.jb51.net/article/133836.htm 搭建服务器之后只能看见test与infomation_schema两个库 https://www.cnblogs.com ...
- 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 ...
- 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 从网上找到的解决方法,以此博客 ...
- 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 ...
随机推荐
- 使用subclass UIActivity的方案来分享图片
IOS6开始, 系统提供了UIActivityViewController, 对图片,文字,url进行相关的操作. 对于缺乏UI设计师的开发来说, 使用它进行轻量级的分享是很好的选择. 最大的缺点是自 ...
- winform中dataGridView隔行显示不同的背景色,鼠标移动上显示不同颜色,离开后变回原色
winform中dataGridView隔行显示不同的背景色,鼠标移动上显示不同颜色,离开后变回原色 先设置奇数行颜色,这个有个自带的属性AlternatingRowsDefaultCellStyle ...
- 学习SQL的点点滴滴(四)-UPDATE小计
1.更新tb_card中c_customer字段的值等于tb_customer表中c_no的值 update tb_card set c_customer=ct.c_no from tb_custom ...
- 01shell入门基础
01shell入门基础 为什么学习和使用shell编程 shell是一种脚本语言,脚本语言是相对于编译语言而言的.脚本语言不需要编译,由解释器读取程序并且执行其中的语句,而编译语言需要编译成可执行代码 ...
- Install Houdini 12.5 x64 in CentOS 7
Thanks for Must(QQ ID)'s big help for installing Houdini in CentOS7. - download HOUDINI_FX_V12.5.371 ...
- 慕课编程题JS选项卡切换
Javascript进阶篇的最后一节是一个选项卡切换的编程,要求效果如下. 这里涉及到两块,一个是内容的切换显示,一个是红色的边框样式切换. 内容切换可以用纯js代码实现,但当这里还需设置一个红色边框 ...
- onAttachedToWindow () 和 onDetachedFromWindow () (转)
原文地址:http://blog.sina.com.cn/s/blog_74c22b2101012urv.html
- 每天一个 Linux 命令(16):which命令
我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索: which 查看可执行文件的位置. whereis 查看文件的位置. locate 配合数据库查看文件位置 ...
- sharedPreferences的用法
做软件开发应该都知道,很多软件会有配置文件,里面存放这程序运行当中的各个属性值,由于其配置信息并不多,如果采用数据库来存放并不划算,因为数据库连 接跟操作等耗时大大影响了程序的效率,因此我们使用键值这 ...
- window下编译并使用google protobuf
参考网址: http://my.oschina.net/chenleijava/blog/261263 http://www.ibm.com/developerworks/cn/linux/l-cn- ...