ERROR! The server quit without updating PID file (/usr/local/var/mysql/what the fuck.local.pid)

mysql安装后,一直是稳定运行,但是突然今天就挂了,启动不了。

我对mac下mysql的目录又极其不熟,网上的教程有很多,关于mysql目录的位置也是五花八门,导致如此的原因可能是因为
每个人使用了不同的安装方式。

我出现的错误是
sudo /usr/local/var/mysql/mysql.server start(通过系统的mysql启动也不行)
Error!The server quit without updating PID file (/usr/local/var/mysql/MyMacBook-Pro.local.pid)

只说我的解决方式,照搬可能不适用

cd /usr/local/var/data

查找.err的文件,mac在这个目录下有很多err结尾的文件,一个个查。我的是这个:MyMacBook-Pro.local.err

这个文件中包含了错误输出:

2018-04-09 14:44:02 2860 [Note] Plugin 'FEDERATED' is disabled.
2018-04-09 14:44:02 2860 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-04-09 14:44:02 2860 [Note] InnoDB: The InnoDB memory heap is disabled
2018-04-09 14:44:02 2860 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-04-09 14:44:02 2860 [Note] InnoDB: Memory barrier is not used
2018-04-09 14:44:02 2860 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-04-09 14:44:02 2860 [Note] InnoDB: Using CPU crc32 instructions
2018-04-09 14:44:02 2860 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-04-09 14:44:02 2860 [Note] InnoDB: Completed initialization of buffer pool
2018-04-09 14:44:02 2860 [Note] InnoDB: Highest supported file format is Barracuda.
2018-04-09 14:44:02 2860 [Note] InnoDB: The log sequence numbers 2462362688 and 2462362688 in ibdata files do not match the log sequence number 2462758734 in the ib_logfiles!
2018-04-09 14:44:02 2860 [Note] InnoDB: Database was not shutdown normally!
2018-04-09 14:44:02 2860 [Note] InnoDB: Starting crash recovery.
2018-04-09 14:44:02 2860 [Note] InnoDB: Reading tablespace information from the .ibd files...
2018-04-09 14:44:02 7fff9506e3c0  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory
InnoDB: Error: could not open single-table tablespace file ./db_hello/email_domain.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

包含了一大坨,没办法,只能一句句的啃了,跟吃屎一样。

InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: Error: could not open single-table tablespace file ./db_hello/email_domain.ibd

这句话已经把启动失败的原因交代的很清楚了。

对,就是它,没权限,至于运行好好的,突然一个表的权限变了,很诚恳的说,我也不晓得

查看了下db_hello下email_domian.ibd的权限

-rwxr-xr-x@ 1 root    _mysql     98304  2  8 15:11 email_domain.ibd

变成了root,md,还特么带了一个@符号(表文件扩展的意思,可用ls -l@ email_domain.ibd查询扩展信息)

改用户到_mysql
chown _mysql:_mysql email_domain.ibd
保存,重新启动,成功

清净了

posted @ 2018-04-09 15:30  微波~  阅读(7888)  评论(0编辑  收藏  举报