代码可能是这么写的:
//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 line68
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in/Library/WebServer/Documents/qa/qa-include/qa-db.phpon line68
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 服务器
相关推荐
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决: 1.打开在创建mysql容器时挂载的conf目录下的mysqld.cnf(如下文件) 我创建docker的姿势 2.进入mysqlId.cnf文件中在...
首先是不知道怎么忽然mysql用命令行,workbench都登录不了,都提示’Access denied for user ‘root’@’localhost’。 数据库卸载重装了几次都不行。好像感觉数据清理不干净。解决的过程遇到的坑,这里记录分享下。...
MySQL密码忘了,可以进行重置设置。安全模式的进入,操作。
php提示错误:Warning: mysql_query() [function.mysql-query]: Access denied for user ‘ODBC’@’localhost’ (using password: NO) 代码: <?php class mysqlClass { function mysqlClass($host='localhost...
主要给大家介绍了关于Linux连接mysql数据库报错:Access denied for user ’root‘@’localhost‘(using password: YES)的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面随着小编来一起...
Access denied for user 'root'@'localhost' (using password: YES) 在网上找了很多解决办法,但是基本只有一个,在.ini文件中的mysqld条目添加 skip-grant-tables 然后重启服务器,再按照刚刚的步骤再来一遍(最后...
主要介绍了mysql Access denied for user ‘root’@’localhost’ (using password: YES)解决方法,本文给出详细的解决步骤及操作注释,需要的朋友可以参考下
解决办法 1.打开/etc/mysql/debian.cnf文件,修改其只读属性 chmod 777 debian.cnf ... ...mysql -udebian-sys-maint -p ...3.进入控制台后.按以下步骤进行(记住使用函数PASSWORD) ...mysql -u root -p Go· again
Unhandled rejection SequelizeAccessDeniedError: Access denied for user 'lupeng'@'localhost' (using password: YES) 这是Node在使用Sequlize连接Mysql数据时报的错,关键看冒号后面的错误:访问拒绝,关键是...
昨天连数据库没有问题,但是今天连接数据库就报这个错误了,网上也搜了不少的方法,有一个方法解决了我的问题。我的环境是Linux ...mysql> update user set password=password("你的新密码") where user="root"; m
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 提示的是用户访问被拒绝,原因是密码不正确,但是我们明明配置的是正确的密码,原因就在yml中: spring: datasource: ...
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES) 解决方法: 1、在启动mysql的参数中加入跳过密码问题方式,如下: vim /etc/my.cnf 并在[mysql]下面加上skip-grant-...
主要给大家介绍了如何解决mysql在创建数据库后出现:Access denied for user 'root'@'%' to database 'xxx'的错误提示,文中介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
主要介绍了mysql登录错误:'Access denied for user 'root'@'localhost',本文给出了操作过程及注意事项,需要的朋友可以参考下
将phpexcelexport文件夹放入ThinkPHP\Library\Vendor中 控制器放哪 应该知道吧
MySQL忘记密码的解决办法: [root@localhost ~]# mysql -uroot -p ERROR 2002 (HY000): Can't connect to local MySQL server...ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) 1、当时我看到这个错误的时候,我专门多试了几次密码,但是密码明明正确啊,然后,我还用sqlyong工具进行连接也可以连接...
error connecting: Error: ER_ACCESS_DENIED_ERROR: Access denied for user ‘root’@’DESKTOP-NLN1UTH’ (using password: YES)加密规则的坑(docker启动) 端口问题的坑。 error connecting: Error: ER_ACCESS_...