MySQL数据库连不上?

---问题描述:17.1.17.11 测试mysql连不上

--开发提供日志显示拒绝连接

--查询系统日志 vi /var/log/messages ---oom-killer 停止mysql进程

Apr 20 14:16:21 ZFRC--FORALL-MYSQL-TEST-93fa37 kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Apr 20 14:16:21 ZFRC--FORALL-MYSQL-TEST-93fa37 kernel: mysqld cpuset=/ mems_allowed=0
Apr 20 14:16:21 ZFRC--FORALL-MYSQL-TEST-93fa37 kernel: CPU: 0 PID: 53077 Comm: mysqld Not tainted 3.10.0-862.el7.x86_64 #1
Apr 20 14:16:21 ZFRC--FORALL-MYSQL-TEST-93fa37 kernel: Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/05/2016


---mysql数据库日志 /data/mysql/mysql3306/data/error.log
2020-04-20T14:16:25.021687+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2020-04-20T14:16:25.021861+08:00 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2020-04-20T14:16:25.021903+08:00 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.26-log) starting as process 53783 ...
2020-04-20T14:16:25.316745+08:00 0 [Note] InnoDB: PUNCH HOLE support available
2020-04-20T14:16:25.316805+08:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-04-20T14:16:25.316815+08:00 0 [Note] InnoDB: Uses event mutexes
2020-04-20T14:16:25.316824+08:00 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2020-04-20T14:16:25.316847+08:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-04-20T14:16:25.316855+08:00 0 [Note] InnoDB: Using Linux native AIO
2020-04-20T14:16:25.318527+08:00 0 [Note] InnoDB: Number of pools: 1
2020-04-20T14:16:25.318717+08:00 0 [Note] InnoDB: Not using CPU crc32 instructions
2020-04-20T14:16:25.335030+08:00 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2020-04-20T14:16:25.668577+08:00 0 [Note] InnoDB: Completed initialization of buffer pool
2020-04-20T14:16:25.702450+08:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-04-20T14:16:26.231742+08:00 0 [Note] InnoDB: Opened 2 undo tablespaces
2020-04-20T14:16:26.231792+08:00 0 [Note] InnoDB: 2 undo tablespaces made active
2020-04-20T14:16:26.232266+08:00 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-04-20T14:16:26.285588+08:00 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 445008830394
2020-04-20T14:16:29.480504+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445014072832
2020-04-20T14:16:29.701784+08:00 0 [Note] InnoDB: Ignoring data file './jamsdb/jams_ac_tcd_dtl.ibd' with space ID 16926, since the redo log references ./jamsdb/jams_ac_tcd_dtl.ibd with space ID 16322.
2020-04-20T14:16:29.883545+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445019315712
2020-04-20T14:16:30.960388+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445024558592
2020-04-20T14:16:34.490765+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445029801472
2020-04-20T14:16:35.277068+08:00 0 [Note] InnoDB: Ignoring data file './plus_userdb/t_plus_merchant_auth_info.ibd' with space ID 17039, since the redo log references ./plus_userdb/t_plus_merchant_auth_info.ibd with space ID 14797.
2020-04-20T14:16:35.587409+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445035044352
2020-04-20T14:16:37.148494+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445040287232
2020-04-20T14:16:38.891510+08:00 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 445042130128
2020-04-20T14:16:38.891775+08:00 0 [Note] InnoDB: Database was not shutdown normally!
2020-04-20T14:16:38.891787+08:00 0 [Note] InnoDB: Starting crash recovery.
2020-04-20T14:16:44.647153+08:00 0 [Note] InnoDB: Transaction 423038244 was in the XA prepared state.
2020-04-20T14:16:44.820900+08:00 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 0 row operations to undo
2020-04-20T14:16:44.820943+08:00 0 [Note] InnoDB: Trx id counter is 423038720
2020-04-20T14:16:44.820957+08:00 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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
2020-04-20T14:16:46.213818+08:00 0 [Note] InnoDB: Apply batch completed


---查询数据库启动时间
(product)root@localhost [(none)]>show global status like 'uptime';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime | 931 |
+---------------+-------+
1 row in set (0.00 sec)

(product)root@localhost [(none)]>

--查询内存--禁用了swap
[root@test data]# free -mh
total used free shared buff/cache available
Mem: 7.8G 4.1G 1.3G 299M 2.4G 3.1G
Swap: 0B 0B 0B
---由此发现是因为系统内存溢出导致的MySQL数据库被迫重启

原文地址:https://www.cnblogs.com/ss-33/p/12738771.html