本来 mysql 好的, 之前清理了一次 tmp 下的东西, mysql 在查询的时候提示:
Cant create/write to file /tmp/ib0n3frL
然后停止启动:
- [root@sevck_linux mysql]# service mysqld start
- MySQL Daemon failed to start.
- Starting mysqld: [FAILED]
启动失败了, 看一下日志, 发现配置的时候没添加日志配置
查找 my.cnf, 在 [mysqld] 下添加 log-error=/var/log/mysql/mysql-error.log
配置 mysql 的错误日志, mysql 目录自行设置, 其中记住一点, chown -R mysql:mysql /tmp/mysql
赋予 mysql 目录权限, 因为我是 root, mysql 运行权限为 mysql, 没有权限
再启动 mysql 尝试:
- 180222 10:45:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins
- 180222 10:45:28 InnoDB: Compressed tables use zlib 1.2.3
- 180222 10:45:28 InnoDB: Using Linux native AIO
- ^G/usr/libexec/mysqld: Cant create/write to file /tmp/mysql_data/ibAGn543 (Errcode: 13)
- 180222 10:45:28 InnoDB: Error: unable to create temporary file; errno: 13
- 180222 10:45:28 [ERROR] Plugin InnoDB init function returned error.
- 180222 10:45:28 [ERROR] Plugin InnoDB registration as a STORAGE ENGINE failed.
- 180222 10:45:28 [ERROR] Unknown/unsupported storage engine: InnoDB
- 180222 10:45:28 [ERROR] Aborting
- 180222 10:45:28 [Note] /usr/libexec/mysqld: Shutdown complete
原来是 Cant create/write to file, 那么就好解决了, 看看 mysql_data 目录是否存在
chmod -R 777 /tmp
赋予写的权限, 启动 mysql:
- root@sevck_linux mysql]# service mysqld start
- Starting mysqld: [ OK ]
- just do it.
来源: http://www.bubuko.com/infodetail-2502962.html