MySQL中SQL模式的特点总结

时间:2020-04-23 11:53来源:计算机教程
前言 常见错误!1016错误:文件无法打开,使用后台修复或者使用phpmyadmin进行修复。1044错误:数据库用户权限不足,请联系空间商解决1045错误:数据库服务器/数据库用户名/数据库名

前言

常见错误! 1016错误:文件无法打开,使用后台修复或者使用phpmyadmin进行修复。 1044错误:数据库用户权限不足,请联系空间商解决 1045错误:数据库服务器/数据库用户名/数据库名/数据库密码错误,请联系空间商检查帐户。 1054错误:程序文件跟数据库有冲突,请使用正确的程序文件上传上去覆盖。 1146错误:数据表缺失,请恢复备份数据. 1005:创建表失败 1006:创建数据库失败 1007:数据库已存在,创建数据库失败 1008:数据库不存在,删除数据库失败 1009:不能删除数据库文件导致删除数据库失败 1010:不能删除数据目录导致删除数据库失败 1011:删除数据库文件失败 1012:不能读取系统表中的记录 1020:记录已被其他用户修改 1021:硬盘剩余空间不足,请加大硬盘可用空间 1022:关键字重复,更改记录失败 1023:关闭时发生错误 1024:读文件错误 1025:更改名字时发生错误 1026:写文件错误 1032:记录不存在 1036:数据表是只读的,不能对它进行修改 1037:系统内存不足,请重启数据库或重启服务器 1038:用于排序的内存不足,请增大排序缓冲区 1040:已到达数据库的最大连接数,请加大数据库可用连接数 1041:系统内存不足 1042:无效的主机名 1043:无效连接 1044:当前用户没有访问数据库的权限 1045:不能连接数据库,用户名或密码错误 1048:字段不能为空 1049:数据库不存在 1050:数据表已存在 1051:数据表不存在 1054:字段不存在 1065:无效的SQL语句,SQL语句为空 1081:不能建立Socket连接 1114:数据表已满,不能容纳任何记录 1116:打开的数据表太多 1129:数据库出现异常,请重启数据库 1130:连接数据库失败,没有连接数据库的权限 1133:数据库用户不存在 1141:当前用户无权访问数据库 1142:当前用户无权访问数据表 1143:当前用户无权访问数据表中的字段 1146:数据表不存在 1147:未定义用户对数据表的访问权限 1149:SQL语句语法错误 1158:网络错误,出现读错误,请检查网络连接状况 1159:网络错误,读超时,请检查网络连接状况 1160:网络错误,出现写错误,请检查网络连接状况 1161:网络错误,写超时,请检查网络连接状况 1062:字段值重复,入库失败 1169:字段值重复,更新记录失败 1177:打开数据表失败 1180:提交事务失败 1181:回滚事务失败 1203:当前用户和数据库建立的连接已到达数据库的最大连接数,请增大可用的数据库连接数或重启数据库 1205:加锁超时 1211:当前用户没有创建用户的权限 1216:外键约束检查失败,更新子表记录失败 1217:外键约束检查失败,删除或修改主表记录失败 1226:当前用户使用的资源已超过所允许的资源,请重启数据库或重启服务器 1227:权限不足,您无权进行此操作 1235:MySQL版本过低,不具有本功能 2002:Can'tconnectto...通常意味着没有一个MySQL服务器运行在系统上或当试图连接mysqld服务器时,你正在使用一个错误的套接字文件或TCP/IP端口。 说明:以上只是常见错误号,并且解决办法也不一定肯定管用!具体请参考MYSQL手册 更多详细错误代码 错误名称/错误代码SQL状态 ER_HASHCHK1000HY000 ER_NISAMCHK1001HY000 ER_NO1002HY000 ER_YES1003HY000 ER_CANT_CREATE_FILE1004HY000 ER_CANT_CREATE_TABLE1005HY000 ER_CANT_CREATE_DB1006HY000 ER_DB_CREATE_EXISTS1007HY000 ER_DB_DROP_EXISTS1008HY000 ER_DB_DROP_DELETE1009HY000 ER_DB_DROP_RMDIR1010HY000 ER_CANT_DELETE_FILE1011HY000 ER_CANT_FIND_SYSTEM_REC1012HY000 ER_CANT_GET_STAT1013HY000 ER_CANT_GET_WD1014HY000 ER_CANT_LOCK1015HY000 ER_CANT_OPEN_FILE1016HY000 ER_FILE_NOT_FOUND1017HY000 ER_CANT_READ_DIR1018HY000 ER_CANT_SET_WD1019HY000 ER_CHECKREAD1020HY000 ER_DISK_FULL1021HY000 ER_DUP_KEY102223000 ER_ERROR_ON_CLOSE1023HY000 ER_ERROR_ON_READ1024HY000 ER_ERROR_ON_RENAME1025HY000 ER_ERROR_ON_WRITE1026HY000 ER_FILE_USED1027HY000 ER_FILSORT_ABORT1028HY000 ER_FORM_NOT_FOUND1029HY000 ER_GET_ERRNO1030HY000 ER_ILLEGAL_HA1031HY000 ER_KEY_NOT_FOUND1032HY000 ER_NOT_FORM_FILE1033HY000 ER_NOT_KEYFILE1034HY000 ER_OLD_KEYFILE1035HY000 ER_OPEN_AS_READONLY1036HY000 ER_OUTOFMEMORY1037HY001 ER_OUT_OF_SORTMEMORY1038HY001 ER_UNEXPECTED_EOF1039HY000 ER_CON_COUNT_ERROR104008004 ER_OUT_OF_RESOURCES104108004 ER_BAD_HOST_ERROR104208S01 ER_HANDSHAKE_ERROR104308S01 ER_DBACCESS_DENIED_ERROR104442000 ER_ACCESS_DENIED_ERROR104542000 ER_NO_DB_ERROR104642000 ER_UNKNOWN_COM_ERROR104708S01 ER_BAD_NULL_ERROR104823000 ER_BAD_DB_ERROR104942000 ER_TABLE_EXISTS_ERROR105042S01 ER_BAD_TABLE_ERROR105142S02 ER_NON_UNIQ_ERROR105223000 ER_SERVER_SHUTDOWN105308S01 ER_BAD_FIELD_ERROR105442S22 ER_WRONG_FIELD_WITH_GROUP105542000 ER_WRONG_GROUP_FIELD105642000 ER_WRONG_SUM_SELECT105742000 ER_WRONG_VALUE_COUNT105821S01 ER_TOO_LONG_IDENT105942000 ER_DUP_FIELDNAME106042S21 ER_DUP_KEYNAME106142000 ER_DUP_ENTRY106223000 ER_WRONG_FIELD_SPEC106342000 ER_PARSE_ERROR106442000 ER_EMPTY_QUERY106542000 ER_NONUNIQ_TABLE106642000 ER_INVALID_DEFAULT106742000 ER_MULTIPLE_PRI_KEY106842000 ER_TOO_MANY_KEYS106942000 ER_TOO_MANY_KEY_PARTS107042000 ER_TOO_LONG_KEY107142000 ER_KEY_COLUMN_DOES_NOT_EXITS107242000 ER_BLOB_USED_AS_KEY107342000 ER_TOO_BIG_FIELDLENGTH107442000 ER_WRONG_AUTO_KEY107542000 ER_READY107600000 ER_NORMAL_SHUTDOWN107700000 ER_GOT_SIGNAL107800000 ER_SHUTDOWN_COMPLETE107900000 ER_FORCING_CLOSE108008S01 ER_IPSOCK_ERROR108108S01 ER_NO_SUCH_INDEX108242S12 ER_WRONG_FIELD_TERMINATORS108342000 ER_BLOBS_AND_NO_TERMINATED108442000 ER_TEXTFILE_NOT_READABLE1085HY000 ER_FILE_EXISTS_ERROR1086HY000 ER_LOAD_INFO1087HY000 ER_ALTER_INFO1088HY000 ER_WRONG_SUB_KEY1089HY000 ER_CANT_REMOVE_ALL_FIELDS109042000 ER_CANT_DROP_FIELD_OR_KEY109142000 ER_INSERT_INFO1092HY000 ER_UPDATE_TABLE_USED1093HY000 ER_NO_SUCH_THREAD1094HY000 ER_KILL_DENIED_ERROR1095HY000 ER_NO_TABLES_USED1096HY000 ER_TOO_BIG_SET1097HY000 ER_NO_UNIQUE_LOGFILE1098HY000 ER_TABLE_NOT_LOCKED_FOR_WRITE1099HY000 ER_TABLE_NOT_LOCKED1100HY000 ER_BLOB_CANT_HAVE_DEFAULT110142000 ER_WRONG_DB_NAME110242000 ER_WRONG_TABLE_NAME110342000 ER_TOO_BIG_SELECT110442000 ER_UNKNOWN_ERROR1105HY000 ER_UNKNOWN_PROCEDURE110642000 ER_WRONG_PARAMCOUNT_TO_PROCEDURE110742000 ER_WRONG_PARAMETERS_TO_PROCEDURE1108HY000 ER_UNKNOWN_TABLE110942S02 ER_FIELD_SPECIFIED_TWICE111042000 ER_INVALID_GROUP_FUNC_USE111142000 ER_UNSUPPORTED_EXTENSION111242000 ER_TABLE_MUST_HAVE_COLUMNS111342000 ER_RECORD_FILE_FULL1114HY000 ER_UNKNOWN_CHARACTER_SET111542000 ER_TOO_MANY_TABLES1116HY000 ER_TOO_MANY_FIELDS1117HY000 ER_TOO_BIG_ROWSIZE111842000 ER_STACK_OVERRUN1119HY000 ER_WRONG_OUTER_JOIN112042000 ER_NULL_COLUMN_IN_INDEX112142000 ER_CANT_FIND_UDF1122HY000 ER_CANT_INITIALIZE_UDF1123HY000 ER_UDF_NO_PATHS1124HY000 ER_UDF_EXISTS1125HY000 ER_CANT_OPEN_LIBRARY1126HY000 ER_CANT_FIND_DL_ENTRY1127HY000 ER_FUNCTION_NOT_DEFINED1128HY000 ER_HOST_IS_BLOCKED1129HY000 ER_HOST_NOT_PRIVILEGED1130HY000 ER_PASSWORD_ANONYMOUS_USER113142000 ER_PASSWORD_NOT_ALLOWED113242000 ER_PASSWORD_NO_MATCH113342000 ER_UPDATE_INFO1134HY000 ER_CANT_CREATE_THREAD1135HY000 ER_WRONG_VALUE_COUNT_ON_ROW113621S01 ER_CANT_REOPEN_TABLE1137HY000 ER_INVALID_USE_OF_NULL113842000 ER_REGEXP_ERROR113942000 ER_MIX_OF_GROUP_FUNC_AND_FIELDS114042000 ER_NONEXISTING_GRANT114142000 ER_TABLEACCESS_DENIED_ERROR114242000 ER_COLUMNACCESS_DENIED_ERROR114342000 ER_ILLEGAL_GRANT_FOR_TABLE114442000 ER_GRANT_WRONG_HOST_OR_USER114542000 ER_NO_SUCH_TABLE114642S02 ER_NONEXISTING_TABLE_GRANT114742000 ER_NOT_ALLOWED_COMMAND114842000 ER_SYNTAX_ERROR114942000 ER_DELAYED_CANT_CHANGE_LOCK1150HY000 ER_TOO_MANY_DELAYED_THREADS1151HY000 ER_ABORTING_CONNECTION115208S01 ER_NET_PACKET_TOO_LARGE115308S01 ER_NET_READ_ERROR_FROM_PIPE115408S01 ER_NET_FCNTL_ERROR115508S01 ER_NET_PACKETS_OUT_OF_ORDER115608S01 ER_NET_UNCOMPRESS_ERROR115708S01 ER_NET_READ_ERROR115808S01 ER_NET_READ_INTERRUPTED115908S01 ER_NET_ERROR_ON_WRITE116008S01 ER_NET_WRITE_INTERRUPTED116108S01 ER_TOO_LONG_STRING116242000 ER_TABLE_CANT_HANDLE_BLOB116342000 ER_TABLE_CANT_HANDLE_AUTO_INCREMENT116442000 ER_DELAYED_INSERT_TABLE_LOCKED1165HY000 ER_WRONG_COLUMN_NAME116642000 ER_WRONG_KEY_COLUMN116742000 ER_WRONG_MRG_TABLE1168HY000 ER_DUP_UNIQUE116923000 ER_BLOB_KEY_WITHOUT_LENGTH117042000 ER_PRIMARY_CANT_HAVE_NULL117142000 ER_TOO_MANY_ROWS117242000 ER_REQUIRES_PRIMARY_KEY117342000 ER_NO_RAID_COMPILED1174HY000 ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE1175HY000 ER_KEY_DOES_NOT_EXITS1176HY000 ER_CHECK_NO_SUCH_TABLE117742000 ER_CHECK_NOT_IMPLEMENTED117842000 ER_CANT_DO_THIS_DURING_AN_TRANSACTION117925000 ER_ERROR_DURING_COMMIT1180HY000 ER_ERROR_DURING_ROLLBACK1181HY000 ER_ERROR_DURING_FLUSH_LOGS1182HY000 ER_ERROR_DURING_CHECKPOINT1183HY000 ER_NEW_ABORTING_CONNECTION118408S01 ER_DUMP_NOT_IMPLEMENTED1185HY000 ER_FLUSH_MASTER_BINLOG_CLOSED1186HY000 ER_INDEX_REBUILD1187HY000 ER_MASTER1188HY000 ER_MASTER_NET_READ118908S01 ER_MASTER_NET_WRITE119008S01 ER_FT_MATCHING_KEY_NOT_FOUND1191HY000 ER_LOCK_OR_ACTIVE_TRANSACTION1192HY000 ER_UNKNOWN_SYSTEM_VARIABLE1193HY000 ER_CRASHED_ON_USAGE1194HY000 ER_CRASHED_ON_REPAIR1195HY000 ER_WARNING_NOT_COMPLETE_ROLLBACK1196HY000 ER_TRANS_CACHE_FULL1197HY000 ER_SLAVE_MUST_STOP1198HY000 ER_SLAVE_NOT_RUNNING1199HY000 ER_BAD_SLAVE1200HY000 ER_MASTER_INFO1201HY000 ER_SLAVE_THREAD1202HY000 ER_TOO_MANY_USER_CONNECTIONS120342000 ER_SET_CONSTANTS_ONLY1204HY000 ER_LOCK_WAIT_TIMEOUT1205HY000 ER_LOCK_TABLE_FULL1206HY000 ER_READ_ONLY_TRANSACTION120725000 ER_DROP_DB_WITH_READ_LOCK1208HY000 ER_CREATE_DB_WITH_READ_LOCK1209HY000 ER_WRONG_ARGUMENTS1210HY000 ER_NO_PERMISSION_TO_CREATE_USER121142000 ER_UNION_TABLES_IN_DIFFERENT_DIR1212HY000 ER_LOCK_DEADLOCK121340001 ER_TABLE_CANT_HANDLE_FULLTEXT1214HY000 ER_CANNOT_ADD_FOREIGN1215HY000 ER_NO_REFERENCED_ROW121623000 ER_ROW_IS_REFERENCED121723000 ER_CONNECT_TO_MASTER121808S01 ER_QUERY_ON_MASTER1219HY000 ER_ERROR_WHEN_EXECUTING_COMMAND1220HY000 ER_WRONG_USAGE1221HY000 ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT122221000 ER_CANT_UPDATE_WITH_READLOCK1223HY000 ER_MIXING_NOT_ALLOWED1224HY000 ER_DUP_ARGUMENT1225HY000 ER_USER_LIMIT_REACHED122642000 ER_SPECIFIC_ACCESS_DENIED_ERROR1227HY000 ER_LOCAL_VARIABLE1228HY000 ER_GLOBAL_VARIABLE1229HY000 ER_NO_DEFAULT123042000 ER_WRONG_VALUE_FOR_VAR123142000 ER_WRONG_TYPE_FOR_VAR123242000 ER_VAR_CANT_BE_READ1233HY000 ER_CANT_USE_OPTION_HERE123442000 ER_NOT_SUPPORTED_YET123542000 ER_MASTER_FATAL_ERROR_READING_BINLOG1236HY000 ER_WRONG_FK_DEF123742000 ER_KEY_REF_DO_NOT_MATCH_TABLE_REF1238HY000 ER_CARDINALITY_COL123921000 ER_SUBSELECT_NO_1_ROW124021000 ER_UNKNOWN_STMT_HANDLER1241HY000 ER_CORRUPT_HELP_DB1242HY000 ER_CYCLIC_REFERENCE1243HY000 ER_AUTO_CONVERT1244HY000 ER_ILLEGAL_REFERENCE124542S22 ER_DERIVED_MUST_HAVE_ALIAS124642000 ER_SELECT_REDUCED124701000 ER_TABLENAME_NOT_ALLOWED_HERE124842000 ER_NOT_SUPPORTED_AUTH_MODE124908004 ER_SPATIAL_CANT_HAVE_NULL125042000 ER_COLLATION_CHARSET_MISMATCH125142000 ER_SLAVE_WAS_RUNNING1252HY000 ER_SLAVE_WAS_NOT_RUNNING1253HY000 ER_TOO_BIG_FOR_UNCOMPRESS1254HY000 ER_ZLIB_Z_MEM_ERROR1255HY000 ER_ZLIB_Z_BUF_ERROR1256HY000 ER_ZLIB_Z_DATA_ERROR1257HY000 ER_CUT_VALUE_GROUP_CONCAT1258HY000 ER_WARN_TOO_FEW_RECORDS125901000 ER_WARN_TOO_MANY_RECORDS126001000 ER_WARN_NULL_TO_NOTNULL126101000 ER_WARN_DATA_OUT_OF_RANGE126201000 ER_WARN_DATA_TRUNCATED126301000 ER_WARN_USING_OTHER_HANDLER126401000 ER_CANT_AGGREGATE_COLLATIONS126542000 ER_DROP_USER126642000 ER_REVOKE_GRANTS126742000

SQL模式影响MySQL支持的SQL语法和执行的数据验证检查。

MySQL服务器可以在不同的SQL模式下运行,并且可以针对不同的客户端以不同的方式应用这些模式,具体取决于sql_mode系统变量的值。DBA可以设置全局SQL模式以匹配站点服务器操作要求,并且每个应用程序可以将其会话SQL模式设置为其自己的要求。

模式会影响MySQL支持的SQL语法以及它执行的数据验证检查。这使得在不同环境中使用MySQL以及将MySQL与其他数据库服务器一起使用变得更加容易。

下面话不多说了,来一起看看详细的介绍吧

设置SQL模式

要在运行时更改SQL模式,请sql_mode使用以下SET 语句设置全局或会话 系统变量

SET GLOBAL sql_mode = 'modes';SET SESSION sql_mode = 'modes';

模式列表

模式

注释

ALLOW_INVALID_DATES 无效日期会生成错误 ERROR_FOR_DIVISION_BY_ZERO 除0错误 NO_BACKSLASH_ESCAPES 禁止使用反斜杠字符作为字符串中的转义字符。启用此模式后,反斜杠就像其他任何一个普通字符一样。 NO_UNSIGNED_SUBTRACTION 在整数值之间减去 UNSIGNED,默认情况下会产生无符号结果。如果结果否则为负,则会导致错误 NO_ZERO_IN_DATE '0000-00-00' 则允许并且插入产生警告 ONLY_FULL_GROUP_BY select 内指定字段必须出现在 groupby 中,否则错误 STRICT_TRANS_TABLES 为事务存储引擎启用严格的SQL模式,并在可能的情况下为非事务性存储引擎启用。 STRICT_ALL_TABLES 为所有存储引擎启用严格SQL模式。无效的数据值被拒绝。

编辑:计算机教程 本文来源:MySQL中SQL模式的特点总结

关键词: