在MySQL的使用过程中,我们可能会碰到“Access denied for user 'root'@'localhost' (using password:YES)”的问题,那么接下来我们就来解决它。

  经过我的百度查询最后得出结论:出现这种错误有两种可能,一是MySQL的root用户的密码错误,二是权限不够的问题。通常解决办法是修改密码。。。

  由于我使用的是Windows系统,所以方法也是Windows系统的修改方法:

  1、开始 → 搜索栏里面输入cmd → 右键cmd.exe选择以管理员的身份运行(亦可以在C:\Windows\System32目录下找到这个cmd.exe,右键,以管理员身份运行)

  2、输入net stop mysql停止MySQL服务

  3、输入命令行来到mysql的bin目录下,输入下列粗体命令

  D:\MySQL\bin>mysqld  --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables

  等一下,显示出以下结果说明MySQL启动:

   22:26:09 [Warning] The syntax '--log' is deprecated and will be removed  inMySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
   22:26:09 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '--slow_query_log'/'--  slow_query_log_file' instead.
   22:26:09 [Warning] The syntax '--log' is deprecated and will be removed in MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
   22:26:09 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file' instead.
   22:26:09 [ERROR] The update log is no longer supported by MySQL in version 5.0 and above. It is replaced by the binary log. Now starting MySQL with --log-bin='' instead.
     22:26:09  InnoDB: Started; log sequence number 0 324221
   22:26:09 [Note] mysqld: ready for connections.Version: '5.1.33-community-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

  4、再以管理员的身份打开一个cmd.exe,输入命令行来到mysql的bin目录下,输入:mysql -uroot mysql

  5、进入mysql之后,输入命令行修改密码:

  mysql>update user set authentication_string=password('123456') where user='root';

  6、刷新权限:mysql>flush privileges;

  7、退出mysql:mysql> quit;

  8、关闭MySQL:D:\MySQL\bin>mysqladmin shutdown(出现错误,则:mysqladmin -uroot -p shutdown 然后输入新密码)

  9、至此修改密码完成,可以输入命令行:net start mysql 启动MySQL服务,mysql -uroot -p ,输入密码就可以进入mysql了。

Access denied for user 'root'@'localhost' (using password:YES)解决方法的更多相关文章

  1. MySQL------报错Access denied for user 'root'@'localhost' (using password:NO)解决方法

    报错:Access denied for user 'root'@'localhost' (using password:NO) 原因:没有给用户“root'@'localhost”赋予数据库权限 解 ...

  2. 转载--MYSQL5.7:Access denied for user 'root'@'localhost' (using password:YES)解决方法

    1.打开MySQL目录下的my.ini文件,在文件的最后添加一行"skip-grant-tables",保存并关闭文件; 2.重启MySQL服务; 3.通过cmd行进入MySQL的 ...

  3. linux下mysql出现Access denied for user 'root'@'localhost' (using password: YES)解决方法

    # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # my ...

  4. ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)解决办法

    问题:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 很久没用这台电脑的mysql ...

  5. mac 安装mysql + 修改root用户密码 + 及报Access denied for user 'root'@'localhost' (using password:YES)解决办法

    1.下载MySQL 到mysql的官网http://dev.mysql.com/downloads/mysql/然后在页面中会看到“MySQL Community Server”下方有一个“downl ...

  6. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 解决办法

    一.背景 在Spark中,将DStream写入到MySQL出现错误:java.sql.SQLException: Access denied for user 'root'@'localhost' ( ...

  7. Access denied for user 'root'@'IP' (using password:YES)解决方法

    在MySql的使用过程中,碰到“Access denied for user 'root'@'IP' (using password:YES)”的问题,使用以下语句修改后还是不行. GRANT ALL ...

  8. 连接mysql报错Access denied for user 'root'@'localhost' (using password: YES)解决办法

    1.打开MySQL目录下的my.ini文件,在文件的最后添加一行“skip-grant-tables”(免密码登录),保存并关闭文件,重启MySQL服务. 2.通过命令行进入MySQL的BIN目录,输 ...

  9. MySQL出现 Access denied for user 'root'@'localhost' (using password:YES) 解决办法

    1.先停止MySQL服务,然后在MySQL安装目录(我的是C:\Program Files (x86)\MySQL\MySQL Server 5.1)找到my.ini文件,在最后一行添加skip-gr ...

随机推荐

  1. C# 爬取网页上的数据

    最近工作中需求定时爬取不同城市每天的温度.其实就是通过编程的方法去抓取不同网站网页进行分析筛选的过程..NET提供了很多类去访问并获得远程网页的数据,比如WebClient类和HttpWebReque ...

  2. [转]使用Nginx实现反向代理

    使用Nginx实现反向代理 解释 正向代理的概念 正向代理,也就是传说中的代理,他的工作原理就像一个跳板,简单的说,我是一个用户,我访问不了某网站,但是我能访问一个代理服务器这个代理服务器呢,他能访问 ...

  3. ORACLE删除某用户下所有对象

    ORACLE删除某用户下所有对象 2013-10-26 15:50 4996人阅读 评论(1) 收藏 举报   --.sql脚本 --唯一注意的是下面的D:\dropobj.sql 为操作的.sql; ...

  4. msp430学习笔记-IO及低功耗

    引用:http://bbs.ednchina.com/BLOG_ARTICLE_3013511.HTM MSP430F149有6个8位的IO口,其中P1,P2口占两个中断向量,共可以接16个中断源.还 ...

  5. Mycat 数据库分库分表中间件

    http://www.mycat.io/ Mycat 国内最活跃的.性能最好的开源数据库中间件! 我们致力于开发高性能的开源中间件而努力! 实体书Mycat权威指南 »开源投票支持Mycat下载 »s ...

  6. C# Web Service 初级教学

    原文连接:http://www.codeproject.com/cs/webservices/myservice.asp作者:Chris Maunder Introduction Creating y ...

  7. js jquery 设置cookie

    转自http://yaoqianglilan.blog.163.com/blog/static/70978316201091810435251/ 本人亲测setcookie() getcookie() ...

  8. vue 之radio绑定v-model

    示例: 单选radio <label ><input type="radio" value="0" v-model="branch& ...

  9. 牛逼的lsof命令!!!

    linux lsof命令详解 简介 lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访 ...

  10. Hibernate inverse反转

    inverse: inverse: 指定由哪一方来维护之间的关联关系 false默认,表示不放弃,是主动放 true:表示把关联关系的维护反转(放弃),对集合对象的修改不会被反映到数据库中 容易出现的 ...