当我查看 EC2 实例上的文件时/var/log/mysql/error.log
,我发现在初始启动后有两次关闭和两次重新启动 MySQL。
2019-12-04T06:57:25.835650Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28-0ubuntu0.18.04.4' socket: '/tmp/tmp.D8yMDciKk5/mysqld.sock' port: 0 (Ubuntu)
2019-12-04T06:57:25.848479Z 0 [Note] Giving 0 client threads a chance to die gracefully
2019-12-04T06:57:25.848493Z 0 [Note] Shutting down slave threads
2019-12-04T06:57:25.848499Z 0 [Note] Forcefully disconnecting 0 remaining clients
2019-12-04T06:57:25.848503Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2019-12-04T06:57:25.848537Z 0 [Note] Binlog end
2019-12-04T06:57:25.848834Z 0 [Note] Shutting down plugin 'auth_socket'
2019-12-04T06:57:25.848841Z 0 [Note] Shutting down plugin 'ngram'
2019-12-04T06:57:25.848843Z 0 [Note] Shutting down plugin 'partition'
...
2019-12-04T06:57:28.453076Z 0 [Note] mysqld: ready for connections.
Version: '5.7.28-0ubuntu0.18.04.4' socket: '/tmp/tmp.hkkkvHaGDX/mysqld.sock' port: 3306 (Ubuntu)
2019-12-04T06:57:28.453235Z 0 [Note] Giving 0 client threads a chance to die gracefully
2019-12-04T06:57:28.453247Z 0 [Note] Shutting down slave threads
2019-12-04T06:57:28.453251Z 0 [Note] Forcefully disconnecting 0 remaining clients
2019-12-04T06:57:28.453255Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2019-12-04T06:57:28.453285Z 0 [Note] Binlog end
2019-12-04T06:57:28.453525Z 0 [Note] Shutting down plugin 'auth_socket'
...
2019-12-04T06:57:30.760720Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.28-0ubuntu0.18.04.4' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
有什么方法可以查询系统(通过命令或某些日志文件)来确定哪个进程或用户导致/请求这些重新启动?