mysql无法启动,Error: page 13476 log sequence number xxxx

本文介绍了一种因Error:page13476logsequencenumber导致MySQL无法启动的情况及其解决办法,通过调整innodb_force_recovery参数成功启动,并介绍了如何导出及重新导入数据库的方法。

1、服务器状况,mysql无法启动,日志提示Error: page 13476 log sequence number

2、使用service mysql start命令启动mysql失败

3、查询mysql的日志文件localhost.localdomain.err,提示Error: page 13476 log sequence number 50961222223

4、查询资料和解决办法

5、编辑mysql的配置文件my.cnf,添加innodb_force_recovery属性

设置 innodb_force_recovery = 1,然后保存修改,执行service mysql start命令,启动mysql

innodb_force_recovery = 1不行就改成2,2不行改成3,以此类推,最大值为6,

我是在innodb_force_recovery = 3时启动成功的

6、导出数据库中的数据

7、删除数据库

8、将my.cnf中的innodb_force_recovery 属性改为0,innodb_force_recovery = 0,或者删掉这个属于

9、重启mysql数据库

10、新建数据库,将导出的数据再导入进去即可(也可以重装mysql然后导入数据)


2025-12-19T05:34:37.849417Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2025-12-19T05:34:37.849496Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2025-12-19T05:34:37.849866Z 0 [Note] C:\BtSoft\mysql\MySQL5.7\bin\mysqld.exe (mysqld 5.7.38-log) starting as process 8348 ... 2025-12-19T05:34:37.868526Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2025-12-19T05:34:37.869014Z 0 [Note] InnoDB: Uses event mutexes 2025-12-19T05:34:37.869267Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier 2025-12-19T05:34:37.869618Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2025-12-19T05:34:37.870357Z 0 [Note] InnoDB: Number of pools: 1 2025-12-19T05:34:37.870807Z 0 [Note] InnoDB: Not using CPU crc32 instructions 2025-12-19T05:34:37.873342Z 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M 2025-12-19T05:34:37.890813Z 0 [Note] InnoDB: Completed initialization of buffer pool 2025-12-19T05:34:37.928888Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2025-12-19T05:34:37.935781Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 47795629696 2025-12-19T05:34:37.936452Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 47795678803 2025-12-19T05:34:37.956276Z 0 [Note] InnoDB: Database was not shutdown normally! 2025-12-19T05:34:37.956614Z 0 [Note] InnoDB: Starting crash recovery. 2025-12-19T05:34:38.334975Z 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 0 row operations to undo 2025-12-19T05:34:38.335541Z 0 [Note] InnoDB: Trx id counter is 101645056 2025-12-19T05:34:38.336142Z 0 [Note] InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percent: 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 2025-12-19T05:34:38.853689Z 0 [Note] InnoDB: Apply batch completed 2025-12-19T05:34:38.854109Z 0 [Note] InnoDB: Last MySQL binlog file position 0 55386, file name mysql-bin.000051 2025-12-19T05:34:38.961866Z 0 [Note] InnoDB: Cleaning up trx with id 101609997 2025-12-19T05:34:39.294080Z 0 [ERROR] InnoDB: In file '.\20251107_092631\auth.ibd', tablespace id and flags are 828 and 33, but in the InnoDB data dictionary they are 122 and 33. Have you moved InnoDB .ibd files around without using the commands DISCARD TABLESPACE and IMPORT TABLESPACE? Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue. 2025-12-19T05:34:39.295376Z 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2025-12-19T05:34:39.295740Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2025-12-19T05:34:39.296279Z 0 [ERROR] InnoDB: Could not find a valid tablespace file for `20251107_092631/auth`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue. 2025-12-19T05:34:39.296984Z 0 [Warning] InnoDB: Ignoring tablespace `20251107_092631/auth` because it could not be opened. 2025-12-19T05:34:39.379037Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" 2025-12-19T05:34:39.379567Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2025-12-19T05:34:39.380394Z 0 [Note] InnoDB: Setting file 'D:\MySQL\Data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2025-12-19T05:34:39.435030Z 0 [Note] InnoDB: File 'D:\MySQL\Data\ibtmp1' size is now 12 MB. 2025-12-19T05:34:39.455825Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2025-12-19T05:34:39.456485Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2025-12-19T05:34:39.457305Z 0 [Note] InnoDB: Waiting for purge to start 2025-12-19T05:34:39.509818Z 0 [Note] InnoDB: 5.7.38 started; log sequence number 47795678803 2025-12-19T05:34:39.510836Z 0 [Note] Plugin 'FEDERATED' is disabled. 2025-12-19T05:34:39.514400Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\MySQL\Data\ib_buffer_pool 2025-12-19T05:34:39.522762Z 0 [Note] Recovering after a crash using mysql-bin 2025-12-19T05:34:39.523590Z 0 [Note] Starting crash recovery... 2025-12-19T05:34:39.523929Z 0 [Note] Crash recovery finished. 2025-12-19T05:34:39.569369Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2025-12-19T05:34:39.569953Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2025-12-19T05:34:39.570390Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2025-12-19T05:34:39.570890Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2025-12-19T05:34:39.572758Z 0 [Warning] CA certificate ca.pem is self signed. 2025-12-19T05:34:39.573483Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. 2025-12-19T05:34:39.574195Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2025-12-19T05:34:39.574741Z 0 [Note] IPv6 is available. 2025-12-19T05:34:39.575017Z 0 [Note] - '::' resolves to '::'; 2025-12-19T05:34:39.575349Z 0 [Note] Server socket created on IP: '::'. 2025-12-19T05:34:39.604561Z 0 [Note] Failed to start slave threads for channel '' 2025-12-19T05:34:39.619077Z 0 [ERROR] InnoDB: Page [page id: space=572, page number=3] log sequence number 47818895373 is in the future! Current system log sequence number 47795679298. 2025-12-19T05:34:39.619873Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery. 2025-12-19T05:34:39.633764Z 0 [Note] Event Scheduler: Loaded 0 events 2025-12-19T05:34:39.634297Z 0 [Note] C:\BtSoft\mysql\MySQL5.7\bin\mysqld.exe: ready for connections. Version: '5.7.38-log' socket: '' port: 3306 MySQL Community Server (GPL) 2025-12-19 13:34:42 0x5d18 InnoDB: Assertion failure in thread 23832 in file fsp0fsp.cc line 3880 InnoDB: Failing assertion: xdes_mtr_get_bit(descr, XDES_FREE_BIT, header_page % FSP_EXTENT_SIZE, mtr) == FALSE InnoDB: We intentionally generate a memory trap. InnoDB: Submit a detailed bug report to http://bugs.mysql.com. InnoDB: If you get repeated assertion failures or crashes, even InnoDB: immediately after the mysqld startup, there may be InnoDB: corruption in the InnoDB tablespace. Please refer to InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. 05:34:42 UTC - mysqld got exception 0x80000003 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. Attempting to collect some information that could help diagnose the problem. As this is a crash and something is definitely wrong, the information collection process might fail. key_buffer_size=134217728 read_buffer_size=131072 max_used_connections=4 max_threads=300 thread_count=4 connection_count=4 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 403530 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x23a27e14790 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... 7ff63abcb302 mysqld.exe!my_errno() 7ffc6838ee1d MSVCR120.dll!raise() 7ffc68394a14 MSVCR120.dll!abort() 7ff63ace7434 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63acfab30 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac64cdf mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac673e6 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac66f29 mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac63e9a mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac2a36e mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ff63ac2e5ac mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z() 7ffc7f294cb0 KERNEL32.DLL!BaseThreadInitThunk() 7ffc8077edcb ntdll.dll!RtlUserThreadStart() Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (0): Connection ID (thread ID): 0 Status: NOT_KILLED The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash. 2025-12-19T05:34:42.715725Z 0 [Note] InnoDB: Buffer pool(s) load completed at 251219 13:34:42
最新发布
12-20
### 问题分析 MySQL 启动时提示 `Can't open and lock privilege tables: Table 'mysql.host' doesn't exist`,通常表示 MySQL 无法访问或初始化其系统权限表。这类问题常见于新安装的 MySQL 实例、数据目录被手动删除或迁移后未正确初始化的情况。权限表如 `mysql.user`、`mysql.host` 是 MySQL 服务器运行的基础,用于管理用户权限和访问控制。当这些表缺失或损坏时,MySQL 服务将无法正常启动[^1]。 --- ### 解决方法 #### 1. 使用 `mysql_install_db` 初始化系统表 对于基于 Linux 的系统,若 MySQL 数据目录未正确初始化,可使用 `mysql_install_db` 工具来创建系统表: ```bash mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql ``` 该命令将生成 `mysql.user`、`mysql.host` 等系统表,确保 MySQL 服务可以正常启动和运行[^1]。 #### 2. 使用 `--initialize` 初始化数据目录(适用于 MySQL 5.7 及以上) 若使用的是 MySQL 5.7.6 或更高版本,推荐使用 `--initialize` 参数进行初始化: ```bash mysqld --initialize --basedir=/usr/local/mysql --datadir=/var/lib/mysql ``` 此命令将自动创建系统数据库和表,并为 `root` 用户生成一个临时密码,输出在控制台或错误日志中[^2]。 #### 3. 手动创建系统表(适用于高级用户) 在某些情况下,可能需要手动执行 SQL 脚本来重建系统表。例如,执行以下命令: ```bash mysql -u root < /usr/local/mysql/scripts/mysql_system_tables.sql mysql -u root < /usr/local/mysql/scripts/fill_help_tables.sql ``` 该操作要求 MySQL 服务已启动,并且当前用户具有足够的权限执行 SQL 脚本[^3]。 #### 4. 检查数据目录权限和配置 确保 MySQL 的数据目录路径配置正确,并且 MySQL 用户对该目录具有读写权限。检查 `my.cnf` 或 `my.ini` 文件中配置的 `datadir` 是否指向正确的路径,并确保目录权限设置如下: ```bash chown -R mysql:mysql /var/lib/mysql chmod -R 755 /var/lib/mysql ``` --- ###
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值