Windows下Mysql 5.7.10不能登陆的问题
2016-01-22 10:39
561 查看
安装完成后,无法登陆mysql,按理说新安装后默认是以root用户登陆,而且密码为空,所以可以直接进的,但是出现了下面的问题
F:\mysql-5.7.10-win32\mysql-5.7.10-win32\bin>mysql -u root
ERROR 1045(28000):Access denied for user 'root'@'localhost'(using password:NO)
经过我上网查资料后发现新版MySQL默认有密码,之后我尝试在配置文件中加了skip-grant-tables,重启之后可以进去了;所以一定是密码的问题
于是我又开始搜索各种解决办法,经过一番努力,终于找到了解决办法
mysql>delete from mysql.user where user='root' and host='localhost';
Query OK, 1 row affected(0.01 sec)
mysql> select user,host from mysql.user;
+-----------+----------+
|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.
F:\mysql-5.7.10-win32\mysql-5.7.10-win32\bin>mysql -u root
ERROR 1045(28000):Access denied for user 'root'@'localhost'(using password:NO)
经过我上网查资料后发现新版MySQL默认有密码,之后我尝试在配置文件中加了skip-grant-tables,重启之后可以进去了;所以一定是密码的问题
于是我又开始搜索各种解决办法,经过一番努力,终于找到了解决办法
mysql>delete from mysql.user where user='root' and host='localhost';
Query OK, 1 row affected(0.01 sec)
mysql> select user,host from mysql.user;
+-----------+----------+
|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.
相关文章推荐
- xampp运行MySQL shutdown unexpectedly解决方案
- MySql简单doc操作
- Mysql Explain 详解
- mysql
- 关于Mysql不能被远程连接的问题
- mybitas返回主键
- 查看mysql集群状态是否正常
- MySql不同版本安装
- mysql笔记02 创建高性能的索引
- MySQL中由load data语句引起死锁的解决案例
- 详解MySQL中的死锁情况以及对死锁的处理方法
- Mysql分区技术 --创建分区表
- mysql 用一个表的一列,去更新另一表的一列
- MySQL数据库的优化 【转】
- MySQL 导出数据保存到文件中
- mysql mysqldump 命令导出指定表的数据
- 同一台MySQL服务器启动多个端口
- Mycat学习笔记 番外篇一.客户端使用latin1字符集,后端MySQL为UTF8字符集,MyCat日志分析。
- Mysql数据库优化---1.可以优化的地方
- 免安装版的MySQL的安装与配置