1. System information:
[[email protected] MgmtStatus]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[[email protected] 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
[[email protected] 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
[[email protected] MgmtStatus]#
2. 默认情况下,直接可以不需要密码访问,无法在本地验证自己创建的用户,以及密码
[[email protected]_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 [email protected] |
+---------------------------------------------------------------------+
| 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 删除之后就可以采用密码形式访问了。
[[email protected] MgmtStatus]# mysql
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
[[email protected] MgmtStatus]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
[[email protected] 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]>
时间: 2024-10-23 23:12:11