service mysql start时报:ERROR! The server quit without updating PID file (/usr/local/mysql/data/mysql1.pid),错误。
1、查看error日志:
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!
发现是由于my.cnf这个文件配置错误导致的。
2、vim /etc/my.cnf
增加:
innodb_data_file_path=ibdata1:12M;ibdata2:10M:autoextend
参数要与已有的表空间一致,也就是/usr/local/mysql/data/目录下的文件size一致。或者直接删除掉ibdata1 ib_logfile0 ib_logfile1这三个文件也可。
再启动,发现还是报这个错误。确认是由于my.cnf文件配置错误造成的。
修改my.cnf文件:
注释:
#pid-file=/var/run/mysqld/mysqld.pid
#socket=/var/lib/mysql/mysql.sock
这两行注释掉。
再启动,即可成功。