新手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 denied for user 'root'@'localhost' (using password: YES)
你好,我也遇到过这个问题,下面是我的解决方法:
首先,通过WAMP打开mysql控制台。
提示输入密码,因为现在是空,所以直接按回车。(wamp 默认数据库密码为空)
然后输入“use mysql”,意思是使用mysql这个数据库,提示“Database changed”就行。
然后输入要修改的密码的sql语句
“ update user set password=PASSWORD('hooray') where user='root'; ”
最后输入“flush privileges;”
,不输入这个的话,修改密码的操作不会生效的。
然后输入“quit”退出。
现在MYSQL已经加上密码了,
这时候通过wampserver访问phpmyadmin会发现无法访问,没有权限,需要输入密码,
这时间就需要改动wamp安装目录里的 config.inc.php文件了!
打开config.inc.php文件,
找到如下位置:
$cfg['Servers'][$i]['user'] = 'root';
在password对应的后面写上之前设置的密码
,然后就可以登录phpmyadmin了!(*^__^*) 嘻嘻……
新手PHP连接MySQL数据库出问题(Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES))的更多相关文章
- MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES
MySQL密码正确却无法本地登录 报错如下: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password ...
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
今天想用用MySQL 数据库 谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到 ...
- (转载)解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
今天想用用MySQL 数据库 谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到 ...
- Mysql相关问题-----1045 Access denied for user 'root'@'localhost' (using password: YES)报错
MySQL 连接错误,使用Navicat连接MySQL出现错误:1045 Access denied for user 'root'@'localhost' (using password: YES) ...
- 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 ...
- Django链接Mysql 8.0 出现错误(1045:Access denied for user 'root'@'localhost' (using password: NO) 的一种解决方法
运行环境: Django版本2.0 ; Mysql 版本 8.0.11; 错误代码: django.db.utils.OperationalError: (1045:Access denied fo ...
- 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 从网上找到的解决方法,以此博客 ...
- 【linux】Centos下登陆mysql报错#1045 - Access denied for user 'root'@'localhost' (using password: NO)
创建mysql 远程链接 grant all privileges on *.* to 'test'@"%" identified by "test666 with g ...
- 解决:MySQL 报错:1045 - Access denied for user 'root'@'localhost'(using password YES)
一.前言 今年疯狂迷上了开源,只要看到好的开源项目,就会不顾一切一股脑扎进去研究,五一期间发现一个很好的关于众筹的开源项目,但不巧,这个项目竟然是 PHP 写的,没学过 PHP,自然对这个开源项目毫无 ...
随机推荐
- Mac下安装最新版本的Graphviz
由于版本兼容问题,Mac下Graphviz之前一直装的是低版本的2.36.高版本的安装方法如下: 1.log in & download Xcode an Xcode Command Line ...
- eclipse安装阿里编码规约插件
点击帮助,Install New Software... 地址为https://p3c.alibaba.com/plugin/eclipse/update 然后选择安装, 一路next即可
- react学习(二)之通信篇
react性能提升原理:虚拟DOM react把真是的DOM tree,转化成virtual DOM,每次数据更新后,重新计算virtual DOM并与上一次的作对比,然后对发生改变的部分进行批量更新 ...
- php对二维数据排序
对于一维数组排序比较简单,像使用sort(),asort(),arsort()等函数进行排序,但是对于二维数组比较麻烦,所有借鉴网上的总结了一下 // 对二维数组进行指定key排序 $arr 二维数组 ...
- 洛谷P4063 [JXOI2017]数列(dp)
题意 题目链接 Sol 这题想还是不难想的,就是写起来很麻烦,然后去看了一下loj的最短代码表示只能Orz 首先不难发现一条性质:能够选择的区间一定是不断收缩的,而且新的可选区间一定是旧区间的某个位置 ...
- Redis 开启远程连接
默认 bind 127.0.0.1 即绑定本机 IP,只能本机访问,你也可以绑定别的 IP 地址,如果注释掉,表示不限制 IP,所有 IP 都能访问 # ~~~ WARNING ~~~ If the ...
- IIS 配置 HTTPS
前言 HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer 或 Hypertext Transfer Protocol Secu ...
- 章节四、2-Switch语句
package introduction5; public class SwitchDemo { //switch用于固定值的判断,如星期.人的性别 //if用于判断区间.范围,能够用switch进行 ...
- Linux下对lvm逻辑卷分区大小的调整(针对xfs和ext4不同文件系统)
当我们在安装系统的时候,由于没有合理分配分区空间,在后续维护过程中,发现有些分区空间不够使用,而有的分区空间却有很多剩余空间.如果这些分区在装系统的时候使用了lvm(前提是这些分区要是lvm逻辑卷分区 ...
- Spring MVC 异常处理 (九)
完整的项目案例: springmvc.zip 目录 实例 除了依赖spring-webmvc还需要依赖jackson-databind(用于转换json数据格式) <dependency> ...