XMAPP MySQL 启动后自动停止
XMAPP MySQL 启动后自动停止
问题情况
XMAPP 面板报错如下
11:19:32 [mysql] Error: MySQL shutdown unexpectedly.
11:19:32 [mysql] This may be due to a blocked port, missing dependencies,
11:19:32 [mysql] improper privileges, a crash, or a shutdown by another method.
11:19:32 [mysql] Press the Logs button to view error logs and check
11:19:32 [mysql] the Windows Event Viewer for more clues
11:19:32 [mysql] If you need more help, copy and post this
11:19:32 [mysql] entire log window on the forums
图1
查看日志
[Note] Starting MariaDB 10.4.32-MariaDB source revision c4143f909528e3fab0677a28631d10389354c491 as process 16036
[Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
[Note] InnoDB: Uses event mutexes
[Note] InnoDB: Compressed tables use zlib 1.3
[Note] InnoDB: Number of pools: 1
[Note] InnoDB: Using SSE2 crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: Starting crash recovery from checkpoint LSN=300288
[Note] InnoDB: 128 out of 128 rollback segments are active.
[Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
[Note] InnoDB: Creating shared tablespace for temporary tables
[Note] InnoDB: Setting file '\Project\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
[Note] InnoDB: File '\Project\xampp\mysql\data\ibtmp1' size is now 12 MB.
[Note] InnoDB: Waiting for purge to start
[Note] InnoDB: 10.4.32 started; log sequence number 300297; transaction id 170
[Note] InnoDB: Loading buffer pool(s) from E:\Project\xampp\mysql\data\ib_buffer_pool
[Note] Plugin 'FEEDBACK' is disabled.
[Note] Server socket created on IP: '::'.
发现没有 报错 [Error],说明mysql 是正常启动了,但是之后又关闭了
解决办法
1. 将 xampp\mysql 文件下现有的 data文件 重命名为 data-backup
2. 复制一份 xampp\mysql 文件下的backup 在xampp\mysql文件下(即同一目录下),重命名为 data
3. 将 data-backup 中的 ibdata1 复制到 新的 data 文件中,覆盖其中的 ibdata1
4. 启动Mysql数据库是否成功 将文件数据库 即 data-backup 下面和数据库名称相同的文件夹(如图2) 复制到 data 文件下 ,完成数据恢复
知识:
文件ibdata1被称为MySQL系统表空间,它位于 xampp/mysql/data/mysql 下。这个ibdata1文件包含 MySQL 数据库中的所有表和索引。因此,您必须将其从备份文件夹复制到新创建的文件夹。
初始启动xmapp 需要执行 setup_xampp.bat 完成路径确定,如图3
查看端口的常见命令
netstat -ano | findstr :3306 # 查询端口占用 如 3306 端口
tasklist | findstr mysqld # 查询目标运行程序 如 mysqld
图2
图3