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