Mysql 在 Ubuntu 系统中崩溃

Posted

技术标签:

【中文标题】Mysql 在 Ubuntu 系统中崩溃【英文标题】:Mysql is crashing in Ubuntu system 【发布时间】:2020-12-31 21:33:13 【问题描述】:

我在 Ubuntu 18.04 操作系统中设置了 mysql 5.7 服务器。最初它工作正常

但目前,我正面临 MySQL 服务器崩溃并自动启动的问题。

我检查了 MySQL 错误日志,但无法确定确切的问题。以下是错误日志。

请帮我解决这个问题。提前致谢。

    2020-09-13T07:58:14.974149Z 0 [Warning] Changed limits: max_open_files: 5000 (requested 6600)
2020-09-13T07:58:14.974342Z 0 [Warning] Changed limits: table_open_cache: 1835 (requested 2000)
2020-09-13T07:58:15.144272Z 0 [Warning] option 'max_allowed_packet': unsigned value 2147483648 adjusted to 1073741824
2020-09-13T07:58:15.144327Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-13T07:58:15.145697Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30-0ubuntu0.18.04.1) starting as process 11285 ...
2020-09-13T07:58:15.151751Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-09-13T07:58:15.151779Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-09-13T07:58:15.151786Z 0 [Note] InnoDB: Uses event mutexes
2020-09-13T07:58:15.151792Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-09-13T07:58:15.151798Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-09-13T07:58:15.151804Z 0 [Note] InnoDB: Using Linux native AIO
2020-09-13T07:58:15.153052Z 0 [Note] InnoDB: Number of pools: 1
2020-09-13T07:58:15.155098Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-09-13T07:58:15.156436Z 0 [Note] InnoDB: Initializing buffer pool, total size = 8G, instances = 8, chunk size = 128M
2020-09-13T07:58:15.683704Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-09-13T07:58:15.751089Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-09-13T07:58:15.771050Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-09-13T07:58:15.826685Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 37996450499
2020-09-13T07:58:15.826719Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 37996456045
2020-09-13T07:58:15.840452Z 0 [Note] InnoDB: Database was not shutdown normally!
2020-09-13T07:58:15.840481Z 0 [Note] InnoDB: Starting crash recovery.
2020-09-13T07:58:15.986419Z 0 [Note] InnoDB: 3 transaction(s) which must be rolled back or cleaned up in total 40 row operations to undo
2020-09-13T07:58:15.986443Z 0 [Note] InnoDB: Trx id counter is 1203712
2020-09-13T07:58:15.986591Z 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-09-13T07:58:16.791283Z 0 [Note] InnoDB: Apply batch completed
2020-09-13T07:58:17.666019Z 0 [Note] InnoDB: Starting in background the rollback of uncommitted transactions
2020-09-13T07:58:17.666064Z 0 [Note] InnoDB: Rolling back trx with id 1203280, 12 rows to undo
2020-09-13T07:58:17.670537Z 0 [Note] InnoDB: Rollback of trx with id 1203280 completed
2020-09-13T07:58:17.670554Z 0 [Note] InnoDB: Rolling back trx with id 1203260, 16 rows to undo
2020-09-13T07:58:17.670859Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-09-13T07:58:17.670876Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-09-13T07:58:17.670921Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-09-13T07:58:17.708095Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-09-13T07:58:17.709026Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-09-13T07:58:17.709038Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-09-13T07:58:17.709398Z 0 [Note] InnoDB: Waiting for purge to start
2020-09-13T07:58:17.710544Z 0 [Note] InnoDB: Rollback of trx with id 1203260 completed
2020-09-13T07:58:17.710562Z 0 [Note] InnoDB: Rolling back trx with id 1203249, 12 rows to undo
2020-09-13T07:58:17.730156Z 0 [Note] InnoDB: Rollback of trx with id 1203249 completed
2020-09-13T07:58:17.730176Z 0 [Note] InnoDB: Rollback of non-prepared transactions completed
2020-09-13T07:58:17.759526Z 0 [Note] InnoDB: 5.7.30 started; log sequence number 37996456045
2020-09-13T07:58:17.759694Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-09-13T07:58:17.759935Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-09-13T07:58:17.770470Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-09-13T07:58:17.770487Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-09-13T07:58:17.772535Z 0 [Warning] CA certificate ca.pem is self signed.
2020-09-13T07:58:17.772580Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-09-13T07:58:17.773620Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2020-09-13T07:58:17.773749Z 0 [Note] IPv6 is available.
2020-09-13T07:58:17.773760Z 0 [Note]   - '::' resolves to '::';
2020-09-13T07:58:17.773783Z 0 [Note] Server socket created on IP: '::'.
2020-09-13T07:58:17.776403Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200913 13:28:17
2020-09-13T07:58:17.853042Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/event' is marked as crashed and should be repaired
2020-09-13T07:58:17.853595Z 0 [Warning] Checking table:   './mysql/event'
2020-09-13T07:58:17.853612Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2020-09-13T07:58:17.854467Z 0 [Note] Event Scheduler: Loaded 14 events
2020-09-13T07:58:17.854779Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.30-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'

【问题讨论】:

这能回答你的问题吗? Table is marked as crashed and should be repaired 嗨菲尔,不。这里的挑战是 MySQL 在几天内崩溃。 MySQL 崩溃后数据库会自动恢复。数据库恢复没有这样的挑战。 重新启动计算机 :) 看起来您因为事件表问题而无法停止服务器 【参考方案1】:

你分享的日志说表event已经崩溃,需要修复。您可以尝试以下命令来修复您的mysql中的所有表:

mysqlcheck -uroot -p --repair --all-databases

【讨论】:

以上是关于Mysql 在 Ubuntu 系统中崩溃的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu16.04 vsftpd(3.0.3-3ubunt)vsftpd.conf 文件备份

centos和ubunte网卡桥接和多网卡绑定

ubunt14.04进不了桌面(登录界面循环,密码正确)

Ubunt 20.04 使用CDROM或ISO作为安装源

双系统之删除Ubuntu系统

双系统之删除Ubuntu系统