在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. java 异常和异常处理Exception

    Java Exception: 1.Error 2.Runtime Exception 运行时异常3.Exception 4.throw 用户自定义异常 异常类分两大类型:Error类代表了编译和系统 ...

  2. [转]Windows 注册自定义的协议

    [转自] http://blog.sina.com.cn/s/blog_86e4a51c01010nik.html 1.注册应用程序来处理自定义协议 你必须添加一个新的key以及相关的value到HK ...

  3. 硬盘安装雨林木风Win7旗舰版系统教程

    硬盘安装雨林木风Win7旗舰版系统教程 安装完成,登录后报administrator无权限, F8 进入安全模式,修改administrator的权限.

  4. 外网访问XAMPP失败 解决方案

    xampp 访问出现New XAMPP security concept 收藏 New XAMPP security concept: Access to the requested director ...

  5. 从线性回归到CNN【转】

    原地址:http://zhangliliang.com/2014/06/14/from-lr-to-cnn/ csdn:    http://blog.csdn.net/t0903/article/d ...

  6. 【转】SQL模糊查询

    在进行数据库查询时,有完整查询和模糊查询之分. 一般模糊查询语句如下: SELECT 字段 FROM 表 WHERE 某字段 Like 条件 其中关于条件,SQL提供了四种匹配模式: 1,% :表示任 ...

  7. ExtJS 动态组件与组件封装

      介绍几个有用的函数: Ext.apply---追加配置选项Ext.reg,----注册xtypeExt.extend--扩展组件||操作({}|| cfg)fireEvent自定义事件机制 --- ...

  8. IO模式调查利器blkiomon介绍

    本文链接地址: IO模式调查利器blkiomon介绍 blkiomon 是blktrace工具包带的一个方便用户了解IO情况的工具, 由于blktrace太专业,需要了解的IO协议栈的东西太多,blk ...

  9. 2018-2019-2 《网络对抗技术》Exp2 后门原理与实践 Week4 20165233

    Exp2 后门原理与实践 实验内容 一.基础问题回答 1.例举你能想到的一个后门进入到你系统中的可能方式? 答:通过访问钓鱼网站,无意下载了一些图片或是文件.而这个图片或文件中携带后门. 2.例举你知 ...

  10. svn快速安装

    windows版本控制系统. 用VisualSVN server 服务端和 TortoiseSVN客户端搭配使用 软件下载 VisualSVN-Server:http://subversion.apa ...