Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES)
来源:互联网 发布:php 装饰者模式 编辑:程序博客网 时间:2024/05/22 04:49
http://www.androidren.com/index.php?qa=211&qa_1=warning-mysql_connect-access-denied-root%40-localhost-password
代码可能是这么写的:
//to make a connection with database$conn = mysql_connect("localhost", "root", "password") or die(mysql_error());
在某些情况下,你改成下面就可以解决:
$conn = mysql_connect("localhost", "root")
or $conn = mysql_connect("localhost", "root", "")
但是,有些情况下它的根本原因是你的当前数据库的用户没有获得多数据库访问的授权。
其实,最多的原因可能是你的数据库没有起来。O(∩_∩)O哈哈~
解决方法是你启动数据库。
这种情况下的表现是:
1.在命令行下:
forlong401:Documents forlong401$ sudo mysql --user=root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
2. 在浏览器上:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /Library/WebServer/Documents/qa/qa-include/qa-db.phpon line 68
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in /Library/WebServer/Documents/qa/qa-include/qa-db.php on line 68
Could not establish database connection. Please check the username, password and hostname in the config file, and if necessary set up the appropriate MySQL user and privileges.
3. 在phpmyadmin上:
#2002 无法登录 MySQL 服务器
- Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES)
- #1045 - Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password: YES) 问题解决
- 解决'Access denied for user 'root'@'localhost' (using password: YES)'
- access denied for user 'root'@'localhost' using password yes
- access denied for user 'root'@'localhost' using password yes
- 1045 access denied for user 'root'@'localhost' using password yes
- Access denied for user 'root'@'localhost' (using password: YES)解决办法
- Access denied for user: 'root@localhost' (Using password: YES)
- Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password:YES) 解决方案
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password:YES)
- #1045 - Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password: YES)
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- Access denied for user 'root'@'localhost' (using password: YES)
- 编写函数fun,其功能是:求出1,1+2,1+2+3各项的值, 并放在一维数组a中传回主函数。
- [ASP.NET-VIII] ASP.NET 使用CSS[行内式(style) 嵌入式(class)] + table布局前端控件I
- 菩提缘工艺核雕
- 使用XIB自定义UIView
- Java网络编程笔记6
- Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES)
- 18. 4Sum Leetcode Python
- qt 连接sql sever 数据库课程设计
- What is inode number?
- ORACLE正则表达式
- XCode快捷键
- 4款食谱有效缓解强迫症
- php curl
- launcher3图标icon背景及文字处理