开放原子开发者工作坊 解决mysql不用用户名和密码可以直接登陆的问题

解决mysql不用用户名和密码可以直接登陆的问题

1、默认情况下,mysql不需要输入用户名和密码,就可以登录C:\Users\linzm>mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.32-log MySQL Community Server ...

1、默认情况下,mysql不需要输入用户名和密码,就可以登录

C:\Users\linzm>mysql

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

Your MySQL connection id is 1

Server version: 5.5.32-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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.


2、因为默认安装的mysql,有空用户名的记录

mysql> select count(*) from user where user='';

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

| count(*) |

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

|        1 |

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

1 row in set (0.00 sec)


3、为了安全考虑,需要删除这个功能,可以登录进去mysql,删除掉

mysql>use mysql;

mysql>delete from user where user='';

mysql>flush privileges; (必须的)


4、检查修改的结果:这时候,再次用mysql空用户名登录,报错

C:\Users\linzm>mysql

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


转载于:https://blog.51cto.com/linzm/1275701

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐

  • 浏览量 355
  • 收藏 0
  • 0

所有评论(0)

查看更多评论 
已为社区贡献8602条内容