背景:
启动时报错:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
在error日志中,错误信息:
170715 19:59:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2017-07-15 19:59:19 139774258145312 [Note] /usr/sbin/mysqld (mysqld 10.1.25-MariaDB) starting as process 4136 ...
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Using Linux native AIO
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Using SSE crc32 instructions
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Initializing buffer pool, size = 2.0G
2017-07-15 19:59:19 139774258145312 [Note] InnoDB: Completed initialization of buffer pool
2017-07-15 19:59:19 139774258145312 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 3200 pages, max 0 (relevant if non-zero) pages!
2017-07-15 19:59:19 139774258145312 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-07-15 19:59:19 139774258145312 [ERROR] Plugin 'InnoDB' init function returned error.
2017-07-15 19:59:19 139774258145312 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-07-15 19:59:19 139774258145312 [Note] Plugin 'FEEDBACK' is disabled.
2017-07-15 19:59:19 139774258145312 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-07-15 19:59:19 139774258145312 [ERROR] Aborting
起因:修改了/etc/my.cnf的参数innodb_data_file_path = ibdata1:50M:autoextend
解决方案:删除安装目录下的ibdata1及其相关文件 rm -rvf ib*