操作系统:WINDOWS10 系统

数据库版本:mysql 5.x

提示:access denied for user 'root'@'localhost' using password yes/no

原来都好好的,今天开机上来提示上面的这个错误,重启 MySQL 还是不可以。

注意我这里的环境是 WINDOWS-XP 系统,LINUX 系统下的操作没有验证过,情况不清楚。

1. 管理员登陆系统,停止 MySQL 服务或者结束 MySQL 进程。

2. 启动 WINDOWS 的命令行窗口(即通常的 DOS 窗口:运行cmd),切换到你的 “MySQL\bin” 目录下。
例如我的是 “D:\Program Files\MySQL\MySQL Server 5.2\bin”,然后执行下面的粗体的命令:(注意你的 “my.ini” 位置)

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd D:\Program Files\MySQL\MySQL Server 5.2\bin

C:\Documents and Settings\Administrator>d:

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

100608 9:04:12 InnoDB: Started; log sequence number 0 46409
100608 9:04:12 [Note] mysqld: ready for connections.
Version: '5.2.0-falcon-alpha-community' socket: '' port: 3306 MySQL Community
Server (GPL)
100608 9:06:57 [Warning] Found invalid password for user: 'root@localhost'; Ign
oring user

只要出现上面信息,就说明 MySQL 已经起来了。

3. 不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “MySQL\bin” 目录下,然后执行下面的粗体的命令:

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd D:\Program Files\MySQL\MySQL Server 5.2\bin

C:\Documents and Settings\Administrator>d:

D:\Program Files\MySQL\MySQL Server 5.2\bin>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

然后,就是重新设置密码了!

mysql> UPDATE user SET Password=PASSWORD('root') where USER='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

4. 好了到此步,可以关闭第一个 DOS 窗口了(关闭服务)。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。

5. 在剩下的第二个 DOS 窗口中,用新的 ROOT 密码连接 MySQL。

D:\Program Files\MySQL\MySQL Server 5.2\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community-nt MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> quit
Bye

至此,系统恢复 ROOT 用户管理权限完成,就是管理员密码的问题。

安装MYSQL 出现Error 1045 access denied 的解决方法的更多相关文章

  1. 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 ...

  2. Mysql相关问题-----1045 Access denied for user 'root'@'localhost' (using password: YES)报错

    MySQL 连接错误,使用Navicat连接MySQL出现错误:1045 Access denied for user 'root'@'localhost' (using password: YES) ...

  3. 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 从网上找到的解决方法,以此博客 ...

  4. ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)(转)

    前两天也偶尔出现这个错误,也没在意,因为我重新修改一下mysql的root密码后又可以用了,但昨天却不行,我把root密码修改以后虽然当时能用, 一旦重新进入就都不能用了,可我的密码明明没有错啊?今天 ...

  5. Win7环境下mysql报错1045:Access denied for user root@localhost错误解决方法

    产生场景:在涉及到连接数据库操作的时候,会报1045:Access denied for user root@localhost. 比如:本地建立的数据库连接不上,在IDEA等开发工具中使用反向生成. ...

  6. 【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 ...

  7. tomcat管理页面403 Access Denied的解决方法

    安装tomcat,配置好tomcat环境变量以后,访问manager app页面,出现403 Access Denied错误,解决的方法如下: 首先在conf/tomcat-users.xml文件里面 ...

  8. tomcat8 管理页面403 Access Denied的解决方法

      安装tomcat,配置好tomcat环境变量以后,访问manager app页面,出现403 Access Denied错误,解决的方法如下: 首先在conf/tomcat-users.xml文件 ...

  9. centos 安装mysql 登录进提示 Access denied for user 'root'@'localhost' (using password: NO)

    # service mysqld stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql ...

随机推荐

  1. C#中Socket编程解决应用程序直接的通信

    using System;using System.Collections.Generic;using System.Linq;using System.Text; using System.Net; ...

  2. my9.23(输入输出,写操作)

    #include <iostream> #include <fstream> using namespace std; void write(int data,int len) ...

  3. Django关于filter和get()方法

    首先引入一个问题: 问: card = Card.objects.filter(pk=offline_card_id).get() card = Card.objects.get(pk=offline ...

  4. Hdu 2979 Expensive Drink

    Description There are some water, milk and wine in your kitchen. Your naughty little sister made som ...

  5. uva 10881 - Piotr's Ants

    这个题的突破点就在于蚂蚁不能够穿过对方,故相对位置不变: 另外,又可以把蚂蚁看成运动方向不变: 代码: #include<cstdio> #include<algorithm> ...

  6. 【POJ2406】 Power Strings (KMP)

    Power Strings Description Given two strings a and b we define a*b to be their concatenation. For exa ...

  7. 2016年如果还没有关注这些机器人公司,你就out了

    芯师爷语据 知名市场研究机构IDC发布报告称,预计到2019年,全球机器人及相关服务上的投入将达到1350亿美元,较2015年的710亿美元增长近一倍.报告称,机器人相关投资预计将以每年17%的速度增 ...

  8. leetcode面试准备:Lowest Common Ancestor of a Binary Search Tree & Binary Tree

    leetcode面试准备:Lowest Common Ancestor of a Binary Search Tree & Binary Tree 1 题目 Binary Search Tre ...

  9. java学习多线程之生产者消费者

    在java多线程当中还有一种关系需要我们来重点掌握,那就是生产者和消费者的关系.那么什么是生产者,什么是消费者呢?我们可以举个例子来说,有张三.李四负责生产烤鸭,王五.马六负责吃烤鸭,那么前者生产完烤 ...

  10. Learning WCF Chapter2 Messaging Protocols

    In Chapter 1,you were introduced to fundamental WCF concepts,      在章节1中,学习了wcf中的基础概念including how t ...