Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mariadb 10.1.xx has its own database audit plug-in, which goes directly to the operation process.

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The latest version of MariaDB 10.1.20 uses built-in plug-ins

192.168.1.91 enable database audit

192.168.1.94 remote access, perform ddl,dml,dcl for fine-grained audit

Get up early in the morning and come to the company to do the test, the database is installed first, and go directly to the operation process.

[root@mysql91 /] # mysql-uroot-p

Enter password:

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

Your MariaDB connection id is 4

Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

MariaDB [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.02 sec)

MariaDB [(none)] > use test

Database changed

MariaDB [test] > show tables

Empty set (0.00 sec)

MariaDB [test] >

MariaDB [test] > show variables like 'plugin_dir'

+-- +

| | Variable_name | Value |

+-- +

| | plugin_dir | / usr/local/mysql/lib/plugin/ |

+-- +

1 row in set (0.01 sec)

MariaDB [test] > install plugin server_audit SONAME 'server_audit.so'

Query OK, 0 rows affected (0.05 sec)

MariaDB [test] > show variables like 'server%'

+-+

| | Variable_name | Value |

+-+

| | server_audit_events |

| | server_audit_excl_users |

| | server_audit_file_path | server_audit.log |

| | server_audit_file_rotate_now | OFF |

| | server_audit_file_rotate_size | 1000000 | |

| | server_audit_file_rotations | 9 | |

| | server_audit_incl_users |

| | server_audit_logging | OFF |

| | server_audit_mode | 0 | |

| | server_audit_output_type | file |

| | server_audit_query_log_limit | 1024 | |

| | server_audit_syslog_facility | LOG_USER |

| | server_audit_syslog_ident | mysql-server_auditing |

| | server_audit_syslog_info |

| | server_audit_syslog_priority | LOG_INFO |

| | server_id | 100 | |

+-+

16 rows in set (0.00 sec)

MariaDB [test] > set global server_audit_logging=on

Query OK, 0 rows affected (0.00 sec)

MariaDB [test] > set global server_audit_events='query_ddl';-- fine-grained audit OK

Query OK, 0 rows affected (0.00 sec)

MariaDB [test] > set global server_audit_events='query_dml'

Query OK, 0 rows affected (0.00 sec)

MariaDB [test] > set global server_audit_events='query_dcl'

Query OK, 0 rows affected (0.00 sec)

MariaDB [test] > grant select on *. * to roidba_r@'%' identified by 'roidba_r'

Query OK, 0 rows affected (0.00 sec)

Check the audit of the log

[root@mysql91 mysql] # ls

Aria_log.00000001 ib_buffer_pool ib_logfile1 multi-master.info mysql91.pid server_audit.log

Aria_log_control ib_logfile0 ibdata1 mysql/ performance_schema/ test/

[root@mysql91 mysql] # tail-f server_audit.log

20161227 13Flux 49vl 55magi mysql91 meme rootgery localhostmeme 4pr 12pr QUERYJING TestSet global server_audit_logging=on',0

20161227 13 Flux 54 Flux 37 magnificent mysql91 recorder roidba1 192.168.1.94 6 recorder 21 table QUERYTESTRIMETRY create QUERY T1 (id int)', 0

20161227 13Frog 56purl 28minisql91 values 192.168.1.94 6pje QUERYLING insert QUERY T1 values (2)', 0

20161227 1315 551 mysql91 set id=2 where id=1',0 192.168.1.94 656 QUERYJING testbook update T1 set id=2 where id=1',0

20161227 14 identified by 16 identified by 36 identified by 91 identified by identified by 4 42 QUERYJEREY Testbook grant grant

Specific parameter adjustment, parameter meaning you need to go to the official website to check

I have always insisted that the best document is to read the official document.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report