perrorでMySQLエラーメッセージ確認

MySQLではperrorというツールが付属しており、これを使ってMySQLが出力するエラーコードの意味を確認することができる。Oracleではこれに似たツールとして「oerr」というものがあるので、これについては後日ブログにアップしておこうと思う(⇒参考:oerrでOracleエラーメッセージ確認)。

  • 基本書式は以下の通り。スペースで区切ってエラーコードを複数指定することも可能。


$ perror エラーコード エラーコード

  • ツールの場所を確認


[root@shibainu55 ~]# which perror
/usr/bin/perror
[root@shibainu55 ~]# perror --help
perror Ver 2.10, for redhat-linux-gnu (x86_64)
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Print a description for a system error code or an error code from
a MyISAM/ISAM/BDB table handler.
If you want to get the error for a negative error code, you should use
-- before the first error code to tell perror that there was no more options.

Usage: perror [OPTIONS] [ERRORCODE [ERRORCODE...]]
-?, --help Displays this help and exits.
-I, --info Synonym for --help.
-s, --silent Only print the error message.
-v, --verbose Print error code and message (default).
-V, --version Displays version information and exits.

Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- -----------------------------
verbose TRUE

  • 実行結果例は以下の通り。ここでは「13」「135」「8」と3つのエラーコードを渡している。


[root@shibainu55 ~]# perror 13 135 8
OS error code 13: Permission denied
MySQL error code 135: No more room in record file
OS error code 8: Exec format error