我刚刚遇到了迄今为止我见过的 MySQL 守护进程发出的最随机的错误,一切工作正常,然后突然间它随机崩溃了,现在我启动它时它会输出这个,不确定是不是因为我的“my.cnf”文件很小
这是我的“my.cnf”:
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
datadir=/var/lib/mysql/
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
错误如下:
120817 3:47:26 [Note] Plugin 'FEDERATED' is disabled.
120817 3:47:26 InnoDB: The InnoDB memory heap is disabled
120817 3:47:26 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120817 3:47:26 InnoDB: Compressed tables use zlib 1.2.5
120817 3:47:26 InnoDB: Using Linux native AIO
120817 3:47:26 InnoDB: Initializing buffer pool, size = 128.0M
120817 3:47:26 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 384 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
120817 3:47:26 InnoDB: Could not open or create data files.
120817 3:47:26 InnoDB: If you tried to add new data files, and it failed here,
120817 3:47:26 InnoDB: you should now edit innodb_data_file_path in my.cnf back
120817 3:47:26 InnoDB: to what it was, and remove the new ibdata files InnoDB created
120817 3:47:26 InnoDB: in this failed attempt. InnoDB only wrote those files full of
120817 3:47:26 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
120817 3:47:26 InnoDB: remove old data files which contain your precious data!
120817 3:47:26 [ERROR] Plugin 'InnoDB' init function returned error.
120817 3:47:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120817 3:47:26 [ERROR] mysqld: unknown variable 'max_used_connections=0'
120817 3:47:26 [ERROR] Aborting
120817 3:47:26 [Note] mysqld: Shutdown complete
任何帮助都将不胜感激,谢谢大家!:D
答案1
你最好在服务器论坛而不是编程论坛上问这个问题?
我思考你可以安全地删除 ibdata1 文件,然后重建它们,但为了确保改名ibdata1 文件并重新启动 MySQL。如果失败,请将其重命名并转到正确的位置 ;)
如果有效,运行 mysqlcheck (http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html) 和/或可能将所有数据导出为 SQL (mysqldump),擦除整个数据库并从转储文件重新导入。
答案2
可能是 innodb_data_file_path 的值发生了变化。请检查您的 /etc/mysql/conf.d/* 文件。
如果没有特别说明,则默认为
innodb_data_file_path=ibdata1:10M:autoextend