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.

相關文章
相關標籤/搜索