Windows下Mysql 5.7.10不能登录的问题

     安装完成后,没法登录mysql,按理说新安装后默认是以root用户登录,并且密码为空,因此能够直接进的,可是出现了下面的问题mysql

     F:\mysql-5.7.10-win32\mysql-5.7.10-win32\bin>mysql -u rootsql

     ERROR 1045(28000):Access denied for user 'root'@'localhost'(using password:NO)架构

     通过我上网查资料后发现新版MySQL默认有密码,以后我尝试在配置文件中加了skip-grant-tables,重启以后能够进去了;因此必定是密码的问题ide

     因而我又开始搜索各类解决办法,通过一番努力,终于找到了解决办法ip

     mysql>delete from mysql.user where user='root' and host='localhost';input

     Query OK, 1 row affected(0.01 sec)it

     mysql> select user,host from mysql.user;io

     +-----------+----------+table

     |user         |host       |配置

     +-----------+----------+

     |mysql.sys |localhost   |

     +-----------+----------+

     1 row in set(0.00 sec)

     mysql>flush privileges;

     Query OK,0 rows affected(0.00 sec)

     mysql>grant all on *.* to 'root'@'localhost' identified by 'dingwei351';

     Query OK,0 rows affected, 1 warning(0.00 sec)

     mysql>select user,host from mysql.user;

     +----------+-----------+

     |user        |host         |

     +----------+-----------+

     |mysql.sys |localhost  |

     |root        |localhost  |

     +----------+-----------+

      2 rows in set(0.01 sec)

     可是到这仍是不行,你用下面的命令会发现一个状况

     mysql>select * from mysql.user;

     Grant显示N--mysql权限架构体系(应该是这么说)是关闭的,因此应该执行下面的操做

     mysql>grant all on *.* to 'root'@'localhost' identified by 'dingwei351' with grant option;

     Query OK,0 rows affected(0.01 sec)

     退出mysql,将skip-grant-tables注掉,而后重启mysql。此时再登录就能够了。

      F:\mysql-5.7.10-win32\mysql-5.7.10-win32\bin>mysql -u root -p

      Enter password:**********

      Welcome to the MySQL monitor. Commands end with ; or \g.

      Your MySQL connection id is 2

      Server version:5.7.10  MySQL Community Server<GPL>

      Copyright<c>2000,2015,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.

相关文章
相关标签/搜索