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 ...
随机推荐
- 查看旧版jexus命令
查看jexus版本 curl http://localhost/info
- (转)Image Segmentation with Tensorflow using CNNs and Conditional Random Fields
Daniil's blog Machine Learning and Computer Vision artisan. About/ Blog/ Image Segmentation with Ten ...
- js判断浏览器,包括Edge浏览器
/* * 描述:判断浏览器信息 * 编写:LittleQiang_w * 日期:2016.1.5 * 版本:V1.1 */ //判断当前浏览类型 function BrowserType() { va ...
- LeetCode----Array
Remove Duplicates from Sorted Array 思路:两个指针,头指针在0,尾指针从1开始寻找,找到第一个不等于头指针值的数,覆盖掉头指针后面那个数,然后尾指针往后移. pub ...
- Android应用开发-Activity(重制版)
Android四大组件:Activity,Service,Broadcast Receiver,Content Provider Activity是Context的子类,同时实现了Window.Cal ...
- .NET(C#)中的DataSet、string、DataTable等对象转换成Json
ConvertJson.cs类 using System; using System.Collections.Generic; using System.Text; using System.Data ...
- MySQL中优化sql语句查询常用的种方法
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使用索 ...
- jquery 百度搜索
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- 一个服务器要绑定多个HTTPS站点
默认情况一个服务器的IIS只能绑定一个HTTPS也就是443端口 要实现多个站点对应HTTPS只能更改IIS配置 地址:C:\Windows\system32\inetsrv\config\appli ...
- mybatis的动态sql及模糊查询
1.动态sql 使用类似于jstl表达式来实现 2.模糊查找 用一个对象来封装条件 步骤: 1)新建一个条件实体 package com.hy.mybatis.entity; public class ...