mysql安装后,一直是稳定运行,可是忽然今天就挂了,启动不了。mysql
我对mac下mysql的目录又极其不熟,网上的教程有不少,关于mysql目录的位置也是五花八门,致使如此的缘由多是由于
每一个人使用了不一样的安装方式。sql
我出现的错误是
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)app
只说个人解决方式,照搬可能不适用dom
cd /usr/local/var/dataui
查找.err的文件,mac在这个目录下有不少err结尾的文件,一个个查。个人是这个:MyMacBook-Pro.local.erratom
这个文件中包含了错误输出:spa
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.
包含了一大坨,没办法,只能一句句的啃了,跟吃屎同样。rest
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
这句话已经把启动失败的缘由交代的很清楚了。code
对,就是它,没权限,至于运行好好的,忽然一个表的权限变了,很诚恳的说,我也不晓得orm
查看了下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
保存,从新启动,成功
清净了