MySQL 关闭

MySQL 关闭

我的 VPS 服务器(配备 40GB SSD、2GB RAM 和 2 个 vCPU)中的 mysql 意外关闭。仅托管一个网站(使用 LAMP 堆栈)。当然 - 增加了一些 mysql 限制,以应对必要的较大查询。

我的/var/log/mysql:

2023-01-07T15:44:25.668222Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2611 ...
2023-01-07T15:44:25.705604Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:25.705670Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:25.705682Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:25.705691Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:25.705700Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:25.705718Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:25.706466Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:25.707229Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:25.710921Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:25.771684Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-01-07T15:44:25.785262Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-01-07T15:44:25.816996Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-01-07T15:44:25.840589Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2696483167
2023-01-07T15:44:25.840646Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2696485859
2023-01-07T15:44:25.847610Z 0 [Note] InnoDB: Database was not shutdown normally!
2023-01-07T15:44:25.847647Z 0 [Note] InnoDB: Starting crash recovery.
2023-01-07T15:44:25.891721Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
2023-01-07T15:44:26.403456Z 0 [Note] InnoDB: Apply batch completed
2023-01-07T15:44:26.660431Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-01-07T15:44:26.660461Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-01-07T15:44:26.660503Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-01-07T15:44:26.706265Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-01-07T15:44:26.707267Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-01-07T15:44:26.707290Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-01-07T15:44:26.707562Z 0 [Note] InnoDB: Waiting for purge to start
2023-01-07T15:44:26.757667Z 0 [Note] InnoDB: 5.7.40 started; log sequence number 2696485859
2023-01-07T15:44:26.758077Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-01-07T15:44:26.758429Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-01-07T15:44:26.762983Z 0 [Note] InnoDB: Buffer pool(s) load completed at 230107 15:44:26
2023-01-07T15:44:26.765837Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-01-07T15:44:26.765875Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-01-07T15:44:26.765887Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-01-07T15:44:26.765891Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-01-07T15:44:26.767111Z 0 [Warning] CA certificate ca.pem is self signed.
2023-01-07T15:44:26.767164Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-01-07T15:44:26.768112Z 0 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
2023-01-07T15:44:26.768136Z 0 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2023-01-07T15:44:26.768167Z 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-01-07T15:44:26.769828Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
2023-01-07T15:44:26.770359Z 0 [Warning] Checking table:   './mysql/user'
2023-01-07T15:44:26.770390Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2023-01-07T15:44:26.770941Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/db' is marked as crashed and should be repaired
2023-01-07T15:44:26.771079Z 0 [Warning] Checking table:   './mysql/db'
2023-01-07T15:44:26.771090Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2023-01-07T15:44:26.807257Z 0 [Note] Event Scheduler: Loaded 0 events
2023-01-07T15:44:26.807455Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.40-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
2023-01-07T15:44:41.312280Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:44:41.314899Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2731 ...
2023-01-07T15:44:41.317393Z 0 [Warning] Query cache failed to set size 734003200; new query cache size is 0
2023-01-07T15:44:41.345457Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:41.345501Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:41.345507Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:41.345513Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:41.345518Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:41.345530Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:41.346076Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:41.346617Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:41.349236Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:41.363054Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:41.365838Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2023-01-07T15:44:41.365882Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-01-07T15:44:41.365902Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-07T15:44:41.365914Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-07T15:44:41.365925Z 0 [ERROR] Failed to initialize builtin plugins.
2023-01-07T15:44:41.365932Z 0 [ERROR] Aborting

2023-01-07T15:44:41.365969Z 0 [Note] Binlog end
2023-01-07T15:44:41.366019Z 0 [Note] Shutting down plugin 'CSV'
2023-01-07T15:44:41.370427Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2023-01-07T15:44:42.209225Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:44:42.211882Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2778 ...
2023-01-07T15:44:42.214589Z 0 [Warning] Query cache failed to set size 734003200; new query cache size is 0
2023-01-07T15:44:42.240191Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:42.240242Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:42.240248Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:42.240253Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:42.240258Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:42.240268Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:42.240628Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:42.240896Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:42.243296Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:42.243347Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:42.243355Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2023-01-07T15:44:42.243361Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-01-07T15:44:42.243368Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-07T15:44:42.243373Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-07T15:44:42.243379Z 0 [ERROR] Failed to initialize builtin plugins.
2023-01-07T15:44:42.243384Z 0 [ERROR] Aborting

2023-01-07T15:44:42.243410Z 0 [Note] Binlog end
2023-01-07T15:44:42.243451Z 0 [Note] Shutting down plugin 'CSV'
2023-01-07T15:44:42.248850Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2023-01-07T15:44:43.134107Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:44:43.137274Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2793 ...
2023-01-07T15:44:43.140196Z 0 [Warning] Query cache failed to set size 734003200; new query cache size is 0
2023-01-07T15:44:43.299318Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:43.299362Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:43.299371Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:43.299377Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:43.299383Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:43.299395Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:43.300058Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:43.300376Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:43.307191Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:43.307253Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:43.307262Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2023-01-07T15:44:43.307270Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-01-07T15:44:43.307279Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-07T15:44:43.307290Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-07T15:44:43.307298Z 0 [ERROR] Failed to initialize builtin plugins.
2023-01-07T15:44:43.307304Z 0 [ERROR] Aborting

2023-01-07T15:44:43.307333Z 0 [Note] Binlog end
2023-01-07T15:44:43.307379Z 0 [Note] Shutting down plugin 'CSV'
2023-01-07T15:44:43.310539Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2023-01-07T15:44:44.102124Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:44:44.104693Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2808 ...
2023-01-07T15:44:44.106952Z 0 [Warning] Query cache failed to set size 734003200; new query cache size is 0
2023-01-07T15:44:44.267543Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:44.267596Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:44.267602Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:44.267608Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:44.267620Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:44.267633Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:44.271851Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:44.272252Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:44.279850Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:44.279947Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:44.279960Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2023-01-07T15:44:44.279968Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-01-07T15:44:44.279981Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-07T15:44:44.280001Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-07T15:44:44.280013Z 0 [ERROR] Failed to initialize builtin plugins.
2023-01-07T15:44:44.280023Z 0 [ERROR] Aborting

2023-01-07T15:44:44.280116Z 0 [Note] Binlog end
2023-01-07T15:44:44.280233Z 0 [Note] Shutting down plugin 'CSV'
2023-01-07T15:44:44.284075Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2023-01-07T15:44:45.098575Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:44:45.101501Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2824 ...
2023-01-07T15:44:45.104350Z 0 [Warning] Query cache failed to set size 734003200; new query cache size is 0
2023-01-07T15:44:45.191218Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:44:45.191270Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:44:45.191277Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:44:45.191283Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:44:45.191288Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:44:45.191301Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:44:45.194327Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:44:45.195625Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:44:45.214457Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:45.214534Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:45.214549Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2023-01-07T15:44:45.214556Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-01-07T15:44:45.214566Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-07T15:44:45.214572Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-07T15:44:45.214579Z 0 [ERROR] Failed to initialize builtin plugins.
2023-01-07T15:44:45.214587Z 0 [ERROR] Aborting

2023-01-07T15:44:45.214619Z 0 [Note] Binlog end
2023-01-07T15:44:45.214672Z 0 [Note] Shutting down plugin 'CSV'
2023-01-07T15:44:45.217222Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2023-01-07T15:47:01.439999Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-01-07T15:47:01.443574Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40-0ubuntu0.18.04.1) starting as process 2854 ...
2023-01-07T15:47:01.506229Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-01-07T15:47:01.506287Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-01-07T15:47:01.506299Z 0 [Note] InnoDB: Uses event mutexes
2023-01-07T15:47:01.506308Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-01-07T15:47:01.506318Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-01-07T15:47:01.506334Z 0 [Note] InnoDB: Using Linux native AIO
2023-01-07T15:47:01.506973Z 0 [Note] InnoDB: Number of pools: 1
2023-01-07T15:47:01.507240Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-01-07T15:47:01.510255Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:47:01.587755Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-01-07T15:47:01.603214Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-01-07T15:47:01.623766Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-01-07T15:47:01.658441Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2696485970
2023-01-07T15:47:01.658490Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2696492637
2023-01-07T15:47:01.659832Z 0 [Note] InnoDB: Database was not shutdown normally!
2023-01-07T15:47:01.659879Z 0 [Note] InnoDB: Starting crash recovery.
2023-01-07T15:47:01.720134Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
2023-01-07T15:47:01.738663Z 0 [Note] InnoDB: Apply batch completed
2023-01-07T15:47:02.141795Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-01-07T15:47:02.141856Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-01-07T15:47:02.142011Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-01-07T15:47:02.203081Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-01-07T15:47:02.205816Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-01-07T15:47:02.205858Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-01-07T15:47:02.206489Z 0 [Note] InnoDB: Waiting for purge to start
2023-01-07T15:47:02.256639Z 0 [Note] InnoDB: 5.7.40 started; log sequence number 2696492637
2023-01-07T15:47:02.257238Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-01-07T15:47:02.266169Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-01-07T15:47:02.266204Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-01-07T15:47:02.266215Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-01-07T15:47:02.266222Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-01-07T15:47:02.267292Z 0 [Warning] CA certificate ca.pem is self signed.
2023-01-07T15:47:02.267345Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-01-07T15:47:02.267485Z 0 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
2023-01-07T15:47:02.267505Z 0 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2023-01-07T15:47:02.267554Z 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-01-07T15:47:02.283219Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-01-07T15:47:02.291076Z 0 [Note] InnoDB: Buffer pool(s) load completed at 230107 15:47:02
2023-01-07T15:47:02.298467Z 0 [Note] Event Scheduler: Loaded 0 events
2023-01-07T15:47:02.301630Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.40-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

在同一日志中也会得到类似的内容:

2023-01-07T17:57:09.387532Z 469 [Note] Access denied for user 'root'@'185.159.162.210' (using password: NO)
2023-01-07T17:57:09.532129Z 470 [Note] Access denied for user 'root'@'185.159.162.210' (using password: YES)

说实话 - 一分钟内有 40-80 件类似的事情。这是否意味着我受到了攻击,还是什么?

文件的配置:/etc/mysql/mysql.conf.d/mysqld.cnf

key_buffer_size         = 160M
max_allowed_packet      = 160M
thread_stack            = 192K
myisam-recover-options  = BACKUP
query_cache_type=1
query_cache_limit       = 500M
query_cache_size        = 700M
innodb_buffer_pool_size = 512M

Ubuntu v18 Mysql 服务器版本:5.7.40-0ubuntu0.18.04.1-(Ubuntu)在 phpmyadmin 中显示。

答案1

对于数据库服务器来说,2 GB 的 RAM 非常少。事实上,您的 MySQL 服务器由于内存不足而出现故障,如以下日志条目所示:

2023-01-07T15:44:41.349236Z 0 [Note] InnoDB: Initializing buffer pool, total size = 512M, instances = 1, chunk size = 128M
2023-01-07T15:44:41.363054Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2023-01-07T15:44:41.365838Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool

通过减少缓冲区大小来减少 MySQL 的内存要求,或者增加 VPS 中的 RAM 数量。

答案2

为了保证您的 2G 服务器正常运行,请考虑以下建议:

key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
myisam-recover-options  = BACKUP
query_cache_type=0
query_cache_limit       = 0
query_cache_size        = 0
innodb_buffer_pool_size = 256M

查看个人资料以获取联系信息。

相关内容