经常见到网友在发一些关于mysql操作出错的解决方法,现在整理一下。mysqlperformanceblog上明确说了,mysql里面出现的errno(操作系统级别的错误)没有经过任何改变,仅仅是封了一个错误代码,然后呈现给用户。下面是手册上对这些操作系统级别错误和其对应错误代码解释:
Linux平台:
-
Number Macro Description 1 EPERMOperation not permitted 2 ENOENTNo such file or directory 3 ESRCHNo such process 4 EINTRInterrupted system call 5 EIOI/O error 6 ENXIONo such device or address 7 E2BIGArg list too long 8 ENOEXECExec format error 9 EBADFBad file number 10 ECHILDNo child processes 11 EAGAINTry again 12 ENOMEMOut of memory 13 EACCESPermission denied 14 EFAULTBad address 15 ENOTBLKBlock device required 16 EBUSYDevice or resource busy 17 EEXISTFile exists 18 EXDEVCross-device link 19 ENODEVNo such device 20 ENOTDIRNot a directory 21 EISDIRIs a directory 22 EINVALInvalid argument 23 ENFILEFile table overflow 24 EMFILEToo many open files 25 ENOTTYInappropriate ioctl for device 26 ETXTBSYText file busy 27 EFBIGFile too large 28 ENOSPCNo space left on device 29 ESPIPEIllegal seek 30 EROFSRead-only file system 31 EMLINKToo many links
windows平台:-
Number Macro Description 1 ERROR_INVALID_FUNCTIONIncorrect function. 2 ERROR_FILE_NOT_FOUNDThe system cannot find the file specified. 3 ERROR_PATH_NOT_FOUNDThe system cannot find the path specified. 4 ERROR_TOO_MANY_OPEN_FILESThe system cannot open the file. 5 ERROR_ACCESS_DENIEDAccess is denied. 6 ERROR_INVALID_HANDLEThe handle is invalid. 7 ERROR_ARENA_TRASHEDThe storage control blocks were destroyed. 8 ERROR_NOT_ENOUGH_MEMORYNot enough storage is available to process this command. 9 ERROR_INVALID_BLOCKThe storage control block address is invalid. 10 ERROR_BAD_ENVIRONMENTThe environment is incorrect. 11 ERROR_BAD_FORMATAn attempt was made to load a program with an incorrect format. 12 ERROR_INVALID_ACCESSThe access code is invalid. 13 ERROR_INVALID_DATAThe data is invalid. 14 ERROR_OUTOFMEMORYNot enough storage is available to complete this operation. 15 ERROR_INVALID_DRIVEThe system cannot find the drive specified. 16 ERROR_CURRENT_DIRECTORYThe directory cannot be removed. 17 ERROR_NOT_SAME_DEVICEThe system cannot move the file to a different disk drive. 18 ERROR_NO_MORE_FILESThere are no more files. 19 ERROR_WRITE_PROTECTThe media is write protected. 20 ERROR_BAD_UNITThe system cannot find the device specified. 21 ERROR_NOT_READYThe device is not ready. 22 ERROR_BAD_COMMANDThe device does not recognize the command. 23 ERROR_CRCData error (cyclic redundancy check). 24 ERROR_BAD_LENGTHThe program issued a command but the command length is incorrect. 25 ERROR_SEEKThe drive cannot locate a specific area or track on the disk. 26 ERROR_NOT_DOS_DISKThe specified disk or diskette cannot be accessed. 27 ERROR_SECTOR_NOT_FOUNDThe drive cannot find the sector requested. 28 ERROR_OUT_OF_PAPERThe printer is out of paper. 29 ERROR_WRITE_FAULTThe system cannot write to the specified device. 30 ERROR_READ_FAULTThe system cannot read from the specified device. 31 ERROR_GEN_FAILUREA device attached to the system is not functioning. 32 ERROR_SHARING_VIOLATIONThe process cannot access the file because it is being used by another process. 33 ERROR_LOCK_VIOLATIONThe process cannot access the file because another process has locked a portion of the file. 34 ERROR_WRONG_DISKThe wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. 36 ERROR_SHARING_BUFFER_EXCEEDEDToo many files opened for sharing. 38 ERROR_HANDLE_EOFReached the end of the file. 39 ERROR_HANDLE_DISK_FULLThe disk is full. 87 ERROR_INVALID_PARAMETERThe parameter is incorrect. 112 ERROR_DISK_FULLThe disk is full. 123 ERROR_INVALID_NAMEThe file name, directory name, or volume label syntax is incorrect. 1450 ERROR_NO_SYSTEM_RESOURCESInsufficient system resources exist to complete the requested service.
有了这些错误代码,我想解决很多问题就简单多了,,另外需要注意,os级别的错误指的是errno,而不是 ERROR xxx(HY000)这个错误代码,后者是mysql自身的。
参考文章:
-
2. http://www.mysqlperformanceblog.com/2012/03/26/how-to-diagnose-errors-in-the-mysql-error-log/
本文整理了MySQL中出现的操作系统级错误代码及其含义,包括Linux和Windows平台上的errno错误,并区分了MySQL自身错误代码,有助于诊断MySQL操作过程中的问题。
383

被折叠的 条评论
为什么被折叠?



