码迷,mamicode.com
首页 > 数据库 > 详细

2016/7/20 12:17:54 MariaDB 默认情况下,无法验证密码

时间:2016-07-20 13:13:44      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

1. System information:
  1. [root@mgt MgmtStatus]# cat /etc/redhat-release
  2. Red Hat Enterprise Linux Server release 7.2 (Maipo)
  3. [root@mgt MgmtStatus]# uname -a
  4. Linux mgt 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
  5. [root@mgt MgmtStatus]# rpm -qa | grep mariadb
  6. mariadb-server-5.5.44-2.el7.x86_64
  7. mariadb-5.5.44-2.el7.x86_64
  8. mariadb-libs-5.5.44-2.el7.x86_64
  9. [root@mgt MgmtStatus]#
2. 默认情况下,直接可以不需要密码访问,无法在本地验证自己创建的用户,以及密码
  1. [root@Rack_TestData ~]# mysql
  2. Welcome to the MariaDB monitor. Commands end with ; or \g.
  3. Your MariaDB connection id is 60
  4. Server version: 5.5.41-MariaDB MariaDB Server
  5. Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
  6. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  7. MariaDB [(none)]>
3. 通过查看当前登录用户的属性,可以发现有一个空账户。
  1. MariaDB [(none)]> show grants;
  2. +---------------------------------------------------------------------+
  3. | Grants for root@localhost |
  4. +---------------------------------------------------------------------+
  5. | GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ WITH GRANT OPTION |
  6. | GRANT PROXY ON ‘‘@‘‘ TO ‘root‘@‘localhost‘ WITH GRANT OPTION |
  7. +---------------------------------------------------------------------+
  8. 2 rows in set (0.01 sec)
  9. MariaDB [(none)]>
4. 查找user table , 有2个用户名为空的账户,随着包安装的时候,就存在,目前不知道其用途。
  1. MariaDB [(none)]> use mysql
  2. Reading table information for completion of table and column names
  3. You can turn off this feature to get a quicker startup with -A
  4. Database changed
  5. MariaDB [mysql]> select user,host,password from user where user=‘‘;
  6. +------+----------------+----------+
  7. | user | host | password |
  8. +------+----------------+----------+
  9. | | localhost | |
  10. | | rack\_testdata | |
  11. +------+----------------+----------+
  12. 2 rows in set (0.00 sec)
  13. MariaDB [mysql]>
5 删除之后就可以采用密码形式访问了。
  1. [root@mgt MgmtStatus]# mysql
  2. ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
  3. [root@mgt MgmtStatus]# mysql -u root -p
  4. Enter password:
  5. ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
  6. [root@mgt MgmtStatus]# mysql -u root -p
  7. Enter password:
  8. Welcome to the MariaDB monitor. Commands end with ; or \g.
  9. Your MariaDB connection id is 26
  10. Server version: 5.5.44-MariaDB MariaDB Server
  11. Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
  12. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  13. MariaDB [(none)]> use mysql
  14. Reading table information for completion of table and column names
  15. You can turn off this feature to get a quicker startup with -A
  16. Database changed
  17. MariaDB [mysql]> select user,host,password from user where user=‘‘;
  18. Empty set (0.01 sec)
  19. MariaDB [mysql]> select user,host,password from user;
  20. +----------------+-----------+-------------------------------------------+
  21. | user | host | password |
  22. +----------------+-----------+-------------------------------------------+
  23. | root | localhost | *8DB8413E28D4DB2FF73A45BACED76C20FE607F41 |
  24. | root | mgt | *8DB8413E28D4DB2FF73A45BACED76C20FE607F41 |
  25. | root | 127.0.0.1 | *8DB8413E28D4DB2FF73A45BACED76C20FE607F41 |
  26. | root | ::1 | *8DB8413E28D4DB2FF73A45BACED76C20FE607F41 |
  27. | computenodedba | % | *920F6DF0856242E405A8059E19930A80912A00FC |
  28. +----------------+-----------+-------------------------------------------+
  29. 5 rows in set (0.00 sec)
  30. MariaDB [mysql]>






2016/7/20 12:17:54 MariaDB 默认情况下,无法验证密码

标签:

原文地址:http://www.cnblogs.com/topshooter/p/0769342dc3ab5af94683cb1570588321.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!