时间:2020-05-27来源:电脑系统城作者:电脑系统城
mysql> select version() from dual;
+------------+
| version() |
+------------+
| 5.7.21-log |
+------------+
1 row in set (0.00 sec)
mysql> show variables like 'plugin_dir';
+---------------+--------------------------+
| Variable_name | Value |
+---------------+--------------------------+
| plugin_dir | /usr/lib64/mysql/plugin/ |
+---------------+--------------------------+
1 row in set (0.01 sec)
mysql>
# cd /tmp
# tar -xzvf mariadb-5.5.64-linux-systemd-x86_64.tar.gz
# cd mariadb-5.5.64-linux-systemd-x86_64
# find ./ -name "server_audit.so"
./lib/plugin/server_audit.so
# cp /tmp/mariadb-5.5.64-linux-systemd-x86_64/lib/plugin/server_audit.so /usr/lib64/mysql/plugin/
# chmod +x server_audit.so
# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE
mysql> INSTALL PLUGIN server_audit SONAME 'server_audit.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/server_audit.so' (errno: 2 /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib64/mysql/plugin/server_audit.so))
mysql>
# wget -c http://ftp.gnu.org/gnu/libc/glibc-2.14.tar.gz
# tar -zxvf glibc-2.14.tar.gz
# cd glibc-2.14
# mkdir build
# cd build
# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
#make && make install
# ll /lib64/libc.so.6
lrwxrwxrwx 1 root root 12 May 23 18:28 /lib64/libc.so.6 -> libc-2.14.so
# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_PRIVATE
mysql> INSTALL PLUGIN server_audit SONAME 'server_audit.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/server_audit.so' (errno: 2 /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib64/mysql/plugin/server_audit.so))
mysql> INSTALL PLUGIN server_audit SONAME 'server_audit.so';
Query OK, 0 rows affected (0.02 sec)
mysql> SELECT PLUGIN_NAME, PLUGIN_LIBRARY, PLUGIN_STATUS, LOAD_OPTION
-> FROM INFORMATION_SCHEMA.PLUGINS
-> WHERE PLUGIN_LIBRARY = 'server_audit.so';
+--------------+-----------------+---------------+-------------+
| PLUGIN_NAME | PLUGIN_LIBRARY | PLUGIN_STATUS | LOAD_OPTION |
+--------------+-----------------+---------------+-------------+
| SERVER_AUDIT | server_audit.so | ACTIVE | ON |
+--------------+-----------------+---------------+-------------+
1 row in set (0.00 sec)
Version | Introduced |
1.4.7 | MariaDB 10.1.41, MariaDB 10.2.26, MariaDB 10.3.17, MariaDB 10.4.7 |
1.4.5 | MariaDB 10.2.24, MariaDB 10.3.15, MariaDB 10.4.5 |
1.4.4 | MariaDB 5.5.61, MariaDB 10.0.36, MariaDB 10.1.34, MariaDB 10.2.15, MariaDB 10.3.7, MariaDB 10.4.0 |
1.4.0 | MariaDB 5.5.48, MariaDB 10.0.24, MariaDB 10.1.11 |
1.3.0 | MariaDB 5.5.43, MariaDB 10.0.18, MariaDB 10.1.5 |
1.2.0 | MariaDB 5.5.42, MariaDB 10.0.17, MariaDB 10.1.4 |
1.1.7 | MariaDB 5.5.38, MariaDB 10.0.11, MariaDB 10.1.0 |
1.1.6 | MariaDB 5.5.37, MariaDB 10.0.10 |
1.1.5 | MariaDB 10.0.09 |
1.1.4 | MariaDB 5.5.36 |
1.1.3 | MariaDB 5.5.34, MariaDB 10.0.7 |
mysql> show variables like '%server_audit%';
+-------------------------------+-----------------------+
| 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_loc_info | |
| server_audit_logging | OFF |
| server_audit_mode | 1 |
| 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 |
+-------------------------------+-----------------------+
16 rows in set (0.00 sec)
mysql> SET GLOBAL server_audit_logging=ON;
Query OK, 0 rows affected (0.00 sec)
# ls -lrt server*
-rw-r----- 1 mysql mysql 1000048 May 25 05:25 server_audit.log.9
-rw-r----- 1 mysql mysql 1000451 May 25 09:02 server_audit.log.8
-rw-r----- 1 mysql mysql 1000602 May 25 09:35 server_audit.log.7
-rw-r----- 1 mysql mysql 1000816 May 25 09:42 server_audit.log.6
-rw-r----- 1 mysql mysql 1000616 May 25 09:50 server_audit.log.5
-rw-r----- 1 mysql mysql 1000721 May 25 09:55 server_audit.log.4
-rw-r----- 1 mysql mysql 1001032 May 25 10:02 server_audit.log.3
-rw-r----- 1 mysql mysql 1000867 May 25 10:06 server_audit.log.2
-rw-r----- 1 mysql mysql 1001079 May 25 10:12 server_audit.log.1
-rw-r----- 1 mysql mysql 570568 May 25 10:30 server_audit.log
#############################MariaDB Audit Plugin####################################
plugin_load_add = server_audit
server_audit_logging=on
server_audit_events=CONNECT,TABLE,QUERY_DDL,QUERY_DCL,QUERY_DML_NO_SELECT
server_audit_file_path='/var/log/mysql_audit/'
server_audit_file_rotate_size=67108864
server_audit_file_rotations=128
#####################################################################################
mysql> set global server_audit_file_path='/var/log/mysql_audit/';
Query OK, 0 rows affected (0.05 sec)
mysql> set global server_audit_events='CONNECT,TABLE,QUERY_DDL,QUERY_DCL,QUERY_DML_NO_SELECT';
Query OK, 0 rows affected (0.00 sec)
mysql> set global server_audit_file_rotations=128;
Query OK, 0 rows affected (0.00 sec)
mysql> set global server_audit_file_rotate_size=67108864;
Query OK, 0 rows affected (0.00 sec)
mysql>set global server_audit_logging=ON;
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN server_audit SONAME 'server_audit.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/server_audit.so' (errno: 2 /usr/lib64/mysql/plugin/server_audit.so: undefined symbol: my_printf_error)
mysql>
mysql> INSTALL PLUGIN server_audit SONAME 'server_audit.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/server_audit.so' (errno: 2 /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib64/mysql/plugin/server_audit.so))
mysql>
2023-10-30
windows上的mysql服务突然消失提示10061 Unkonwn error问题及解决方案2023-10-30
MySQL非常重要的日志bin log详解2023-10-30
详解MySQL事务日志redo log一、单表查询 1、排序 2、聚合函数 3、分组 4、limit 二、SQL约束 1、主键约束 2、非空约束 3、唯一约束 4、外键约束 5、默认值 三、多表查询 1、内连接 1)隐式内连接: 2)显式内连接: 2、外连接 1)左外连接 2)右外连接 四...
2023-10-30
Mysql删除表重复数据 表里存在唯一主键 没有主键时删除重复数据 Mysql删除表中重复数据并保留一条 准备一张表 用的是mysql8 大家自行更改 创建表并添加四条相同的数据...
2023-10-30