MySQL因/tmp目录读写权限启动失败

启动错误

Starting MySQL.The server quit without updating PID file (/[失败]cal/mysql/var/Aprice2.pid).

错误日志内容(仔细看红色部分)
131111 18:45:02 mysqld_safe mysqld from pid file /usr/local/mysql/var/Aprice2.pid ended
131111 18:50:16 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
131111 18:50:16 [Warning] The syntax ‘–log-slow-queries’ is deprecated and will be removed in a future release. Please use ‘–slow-query-log’/’–slow-query-log-file’ instead.
131111 18:50:16 InnoDB: The InnoDB memory heap is disabled
131111 18:50:16 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131111 18:50:16 InnoDB: Compressed tables use zlib 1.2.3
/usr/local/mysql/bin/mysqld: Can’t create/write to file ‘/tmp/ibPz5wRg’ (Errcode: 13)
131111 18:50:16 InnoDB: Error: unable to create temporary file; errno: 13
131111 18:50:16 [ERROR] Plugin ‘InnoDB’ init function returned error.
131111 18:50:16 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
131111 18:50:16 [ERROR] Unknown/unsupported storage engine: InnoDB
131111 18:50:16 [ERROR] Aborting

131111 18:50:16 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

131111 18:50:16 mysqld_safe mysqld from pid file /usr/local/mysql/var/Aprice2.pid ended

 

上面的错误代码是13,perror显示的信息是:OS error code 13: Permission denied。结合上面的错误日志,显示mysql对/tmp目录没有写权限。
/tmp目录的权限竟然是755,没有写权限!!!,而正常的应该是drwxrwxrwt。真是纳闷,竟然有人更改了/tmp目录的权限(只能说这个程序员太变态了!)。

 

另外今天碰到的两个很有意思的问题
1、nginx定义log_format的时候,结尾少了个分号”;”。在nginx -t检测脚本语法错误的时候,竟然没有报错,而日志写入到默认的access.log中

2、在mysql连接数据的时候,”mysql –uroot -p”写成了”mysql –root -p”,用root密码竟然连接上mysql服务。但是在执行sql的时候,提示“Ignoring query to other database”.
-r选项的作用是“ -r, –raw Write fields without conversion. Used with –batch”,显示的内容不进行转义变换(without escaping conversion)且以表格的形式显示.
-s选项mysql输出可以显示一些转义字符,但不以表格形式显示,即周围的“边框”不显示。
#mysql -uroot -p -r
Enter password:
mysql> insert into ts values (‘\0000001’);
Query OK, 1 row affected (0.00 sec)
mysql> select * from ts;
+———+
| vers        |
+———+
| 000001 |
+———+
1 row in set (0.00 sec)

 

#mysql -uroot -p -s
Enter password:
mysql> use test
mysql> select * from ts;
vers
\0000001

上面的以普通方式输出,而不是表格的方式。

此条目发表在mysql分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.