断电引起的mysql无法启动的问题:
1.报错
shell> mysql.server start
Starting MySQL
.....................................................................................................
ERROR! The server quit without updating PID file (/usr/local/var/mysql/NilYangdeiMac.local.pid).
1.1 日志:
150104 10:32:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2015-01-04 10:32:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-04 10:32:58 869 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2015-01-04 10:32:58 869 [Note] Plugin 'FEDERATED' is disabled.
2015-01-04 10:32:58 869 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-01-04 10:32:58 869 [Note] InnoDB: The InnoDB memory heap is disabled
2015-01-04 10:32:58 869 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-01-04 10:32:58 869 [Note] InnoDB: Memory barrier is not used
2015-01-04 10:32:58 869 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-01-04 10:32:58 869 [Note] InnoDB: Using CPU crc32 instructions
2015-01-04 10:32:58 869 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-01-04 10:32:58 869 [Note] InnoDB: Completed initialization of buffer pool
2015-01-04 10:32:58 869 [Note] InnoDB: Highest supported file format is Barracuda.
2015-01-04 10:32:58 869 [Note] InnoDB: 128 rollback segment(s) are active.
2015-01-04 10:32:58 869 [Note] InnoDB: Waiting for purge to start
2015-01-04 10:32:58 869 [Note] InnoDB: 5.6.21 started; log sequence number 13543003
2015-01-04 10:32:58 869 [Note] RSA private key file not found: /usr/local/var/mysql//private_key.pem. Some authentication plugins will not work.
2015-01-04 10:32:58 869 [Note] RSA public key file not found: /usr/local/var/mysql//public_key.pem. Some authentication plugins will not work.
2015-01-04 10:32:58 869 [Note] Server hostname (bind-address): '*'; port: 3306
2015-01-04 10:32:58 869 [Note] IPv6 is available.
2015-01-04 10:32:58 869 [Note] - '::' resolves to '::';
2015-01-04 10:32:58 869 [Note] Server socket created on IP: '::'.
2015-01-04 10:32:59 869 [Note] Event Scheduler: Loaded 0 events
2015-01-04 10:32:59 869 [Note] /usr/local/Cellar/mysql/5.6.21/bin/mysqld: ready for connections.
Version: '5.6.21' socket: '/tmp/mysql.sock' port: 3306 Homebrew
2015-01-04 19:11:59 869 [Note] /usr/local/Cellar/mysql/5.6.21/bin/mysqld: Normal shutdown
3.解决办法,
3.1. 删掉日志文件,重新来过:
shell> rm ib_logfile0 ib_logfile1 ibdata1
3.2. 删掉mysql进程
shell> ps aux|grep mysqld |grep -v 'grep'| awk '{print $2}'|xargs kill
3.3. Start Mysql
shell> mysql.server start
Starting MySQL
.................................. SUCCESS!
问题解决。