관리 메뉴

투덜이 개발자

mysql log 로그 추적 본문

DataBase/MySQL

mysql log 로그 추적

엠투 2022. 1. 19. 12:48
반응형

mysql 로그 추적

MariaDB [(none)]> 
MariaDB [(none)]> show variables where Variable_name in ('version','log','general_log');
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| general_log   | OFF             |
| version       | 10.1.43-MariaDB |
+---------------+-----------------+
2 rows in set (0.00 sec)

MariaDB [(none)]> show variables like 'general%';
+------------------+------------+
| Variable_name    | Value      |
+------------------+------------+
| general_log      | OFF        |
| general_log_file | gmedia.log |
+------------------+------------+
2 rows in set (0.00 sec)

활성화 하기

MariaDB [(none)]> set global general_log=ON;
Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> show variables where Variable_name in ('version','log','general_log');
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| general_log   | ON              |
| version       | 10.1.43-MariaDB |
+---------------+-----------------+
2 rows in set (0.00 sec)

MariaDB [(none)]> show variables like 'general%';
+------------------+------------+
| Variable_name    | Value      |
+------------------+------------+
| general_log      | ON         |
| general_log_file | gmedia.log |
+------------------+------------+
2 rows in set (0.00 sec)

 

mysql 재시작

[root@gmedia sbin]# systemctl stop mysqld
[root@gmedia sbin]# ps aux | grep mysql
root     15454  0.0  0.0 112716   964 pts/2    R+   13:01   0:00 grep --color=auto mysql
root     28327  0.0  0.1 161244  4272 pts/0    S+   10:14   0:00 mysql -p
[root@gmedia sbin]# systemctl start mysqld
[root@gmedia sbin]# ps aux | grep mysql
mysql    15563 10.0  2.4 814940 94356 ?        Ssl  13:02   0:00 /usr/sbin/mysqld
root     15598  0.0  0.0 112716   960 pts/2    S+   13:02   0:00 grep --color=auto mysql
root     28327  0.0  0.1 161244  4272 pts/0    S+   10:14   0:00 mysql -p
반응형