MySQL 启动失败

今天 安装新数据库 mysql-5.5.16 结果忘记配置一个目录,导致mysql启动失败


111108 16:19:54 mysqld_safe Starting mysqld daemon with databases from /home/soft/mysql/data
/opt/soft/mysql/bin/mysqld: File '/opt/soft/mysql/binlog/mysql-bin.index' not found (Errcode: 2)
111108 16:19:54 [ERROR] Aborting

111108 16:19:54 [Note] /opt/soft/mysql/bin/mysqld: Shutdown complete

111108 16:19:54 mysqld_safe mysqld from pid file /opt/soft/mysql/601.localdomain.pid ended


创建目录后怎么都启动不起来了....

111108 16:25:54 mysqld_safe Starting mysqld daemon with databases from /home/soft/mysql/data
/opt/soft/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
111108 16:25:54 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
111108 16:25:54 InnoDB: The InnoDB memory heap is disabled
111108 16:25:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
111108 16:25:54 InnoDB: Compressed tables use zlib 1.2.3
111108 16:25:54 InnoDB: Initializing buffer pool, size = 128.0M
111108 16:25:54 InnoDB: Completed initialization of buffer pool
111108 16:25:54 InnoDB: Log file /opt/soft/mysql/log/ib_logfile0 did not exist: new to be created
InnoDB: Setting log file /opt/soft/mysql/log/ib_logfile0 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
111108 16:25:58 InnoDB: Log file /opt/soft/mysql/log/ib_logfile1 did not exist: new to be created
InnoDB: Setting log file /opt/soft/mysql/log/ib_logfile1 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
111108 16:26:00 InnoDB: Log file /opt/soft/mysql/log/ib_logfile2 did not exist: new to be created
InnoDB: Setting log file /opt/soft/mysql/log/ib_logfile2 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
111108 16:26:01 InnoDB: Cannot initialize created log files because
111108 16:26:01 InnoDB: data files are corrupt, or new data files were
111108 16:26:01 InnoDB: created when the database was started previous
111108 16:26:01 InnoDB: time but the database was not shut down
111108 16:26:01 InnoDB: normally after that.
111108 16:26:01 [ERROR] Plugin 'InnoDB' init function returned error.
111108 16:26:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
111108 16:26:01 [ERROR] Unknown/unsupported storage engine: innodb
111108 16:26:01 [ERROR] Aborting

111108 16:26:01 [Note] /opt/soft/mysql/bin/mysqld: Shutdown complete

111108 16:26:01 mysqld_safe mysqld from pid file /opt/soft/mysql/601.localdomain.pid ended


后来才想起来,要将 innodb的log文件和表空间文件删除才行


在这里记录下,防止以后再犯...


MySQL 启动失败是一个常见的问题,可能由多种原因引起,包括配置错误、文件损坏、权限问题、端口冲突等。以下是对 MySQL 启动失败的常见原因及对应的解决方案。 ### 1. 服务账户设置错误 MySQL 服务在启动时依赖于特定的系统账户权限。如果该账户没有正确配置,可能导致服务无法启动。可以通过检查服务属性中的登录身份验证设置来确认账户权限是否正确。确保 MySQL 服务使用的账户具有足够的权限访问其安装目录和数据目录。 ### 2. 端口被占用 MySQL 默认使用 3306 端口。如果该端口被其他程序占用,MySQL 将无法启动。可以使用命令 `netstat -ano | findstr :3306`(Windows)或 `lsof -i :3306`(Linux)来查找占用该端口的进程,并终止该进程或更改 MySQL 的端口配置。 ### 3. 数据目录损坏 数据目录中的文件损坏也可能导致 MySQL 启动失败。对于这种情况,可以尝试恢复数据目录。具体步骤包括: - 找到 MySQL 的数据目录,通常位于 `C:\ProgramData\MySQL\MySQL Server 5.7\Data`(Windows)。 - 将数据目录备份到 U 盘或临时目录。 - 卸载 MySQL 并清理所有相关目录。 - 重新安装 MySQL 并测试连接。 - 停止 MySQL 服务,替换新安装的数据目录中的文件(除了某些关键文件如 `ibdata1`)。 - 将备份的数据目录中的文件复制回原位置。 - 重启 MySQL 服务[^2]。 ### 4. 密码或路径错误 如果系统中安装了多个版本的 MySQL,可能会因为密码或服务路径配置错误导致启动失败。可以通过以下方式检查和更新服务路径: - 使用命令 `sc config MySQL binPath= "C:\mysql\bin\mysqld.exe --defaults-file=C:\mysql\my.ini MySQL"` 更新服务路径。 - 确保使用正确的密码进行登录。 ### 5. 防火墙或安全软件阻止 某些防火墙或安全软件可能会阻止 MySQL 服务的启动或访问。可以暂时禁用防火墙或安全软件,检查是否能够正常启动 MySQL。 ### 6. SELinux 配置问题(Linux) 在 Linux 系统上,SELinux 可能会阻止 MySQL 启动。可以通过修改 SELinux 配置文件 `/etc/selinux/config` 中的 `SELINUX` 设置为 `permissive` 或 `disabled` 来解决问题。重启系统后生效。 ### 示例代码 以下是检查 MySQL 服务状态的命令示例: ```bash # 检查 MySQL 服务状态(Linux) sudo systemctl status mysql # 启动 MySQL 服务(Linux) sudo systemctl start mysql # 重启 MySQL 服务(Linux) sudo systemctl restart mysql ``` ```cmd :: 检查 MySQL 服务状态(Windows) net start | findstr "MySQL" :: 启动 MySQL 服务(Windows) net start mysql :: 停止 MySQL 服务(Windows) net stop mysql ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值