ڼС
梦回起点
做你害怕做的事,你会发现:不过如此
本站基于WordPress—主题by 设计窝
冀ICP备15003737号
梦回起点
Copyright © 2015-2024 All rights reserved.

mysql出现ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)解决方法

啥情况??????

D:\Program\mysql\bin>mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

我哪知道啥情况,问百度啊。

百度的方法都试了,但是没用啊。。。。

难道Oracle单独给你做了一份程序?????????

我的天。。。。

怎么解决呢?下面来说说方法。

刚装上(安装方法不再赘述,还是以前安装版的好用,安装过程就设置了,Oracle收购之后,呵呵),不知道root的密码,想改root密码但是又得登录,这不是先有鸡还是现有蛋的问题吗????我又不是哲学家,干嘛为难我。。。。  算了算了,还得用不是。  万能的网友可以解决这个问题,其实很简单。。

http://blog.csdn.net/lxpbs8851/article/details/10895085

首先参考上面的文章,在my.ini文件中加入skip-grant-tables这一行,就不再需要密码登录了,直接跳过验证了,当然文章中也说了,安全性堪忧,所以不要用在正在跑着的服务器上,要用也要先停掉。。

然后重启mysql服务(怎么重启服务???自己百度吧)

d:\Program\mysql\bin mysql -uroot

执行上面的命令发现可以登录了,而且不用密码,有木有

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.11 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

先爽一把。。。

然后

mysql> use mysql
Database changed
mysql> update mysql.user set authentication_string=password('111111') where user='root' and Host = 'localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

执行上面的命令

好了可以删掉my.ini文件中加的哪一行了,删掉之后重启服务(你还不知道???那你前面那步是怎么做的?)

再次登录,发现可以登录,但是我们执行show databases; 确发现下面的问题

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

我的天,你是要闹哪样???,算了再治你一下吧。

执行下面的命令
mysql> alter user 'root'@'localhost' identified by '111111';
Query OK, 0 rows affected (0.00 sec)

完了之后你会发现,和书上的一样了,开始你的学习之旅吧。。。。。。。。

参考资料:

http://blog.csdn.net/ziwen00/article/details/8460754
http://blog.csdn.net/lxpbs8851/article/details/10895085

2017-09-09
                         
  1. 请问大神,你的mysql是单独安装的,还是集成安装的? 🙄

  2. 一般没系统学习过的不会成功

  3. 公交站候车亭

    问题解决了,谢谢大师的教程

发表回复