我们在插入行时遇到此错误。我重置了自动增量并且验证成功。它显示最大值:18446744073709551615并将其更改回16,然后当我们插入行时,它再次出现问题。到目前为止我们唯一注意到的是它被设置为BIGINT 19而其他表是BIGINT 20.还有其他想法吗?
错误:
SQL错误(1467):无法从存储中读取自动增量值 发动机
我使用的是版本10.2.12-MariaDB。 尺寸:63.2 MiB 项目:63.2 MiB 表:140 意见:42 功能:2 程序:2
插入:
Insert into products
(ProductID,`Name`,Type,Price,MSRP,ReorderAt,DepartmentID,DateAdded,Status,QtyOnHand, DefaultTaxAccount,qtyonOrder,AverageCost,CogsAccount,IncomeAccount,AssetType,DiscountRate,Track,DefaultCost)
values
(3901, 'Test', 1, 3.00, 3.00, 0, 5, '1900-01-01', 1, 0, 320, 0, 0, 29, 7, 11, 0, '0', 0)
这是表格:
CREATE TABLE `products` (
`ProductIndex` bigint(19) NOT NULL AUTO_INCREMENT,
`ProductID` bigint(19) DEFAULT 0,
`Name` longtext DEFAULT NULL,
`Type` int(11) DEFAULT 1,
`Description` longtext DEFAULT NULL,
`PartNumber` varchar(50) DEFAULT NULL,
`UPC` varchar(50) DEFAULT NULL,
`Price` decimal(19,4) DEFAULT 0.0000,
`MSRP` decimal(19,4) DEFAULT 0.0000,
`ReorderAt` decimal(30,4) DEFAULT 0.0000,
`DepartmentID` bigint(19) DEFAULT -1,
`DateAdded` date DEFAULT NULL,
`Status` int(11) DEFAULT 1,
`Version` bigint(20) DEFAULT 0,
`QtyOnHand` decimal(30,4) DEFAULT 0.0000,
`Track` tinyint(1) DEFAULT 0,
`DefaultTaxAccount` int(11) DEFAULT 57,
`OLDid` longtext DEFAULT NULL,
`qtyonOrder` decimal(30,4) DEFAULT 0.0000,
`LastRecieved` datetime DEFAULT NULL,
`margin` decimal(19,4) DEFAULT NULL,
`CogsAccount` bigint(20) DEFAULT 2,
`IncomeAccount` bigint(20) DEFAULT 1,
`AssetType` bigint(20) DEFAULT 91,
`AverageCost` decimal(19,4) DEFAULT 0.0000,
`DiscountRate` decimal(19,4) DEFAULT 0.0000,
`QtyOnHold` decimal(30,4) DEFAULT 0.0000,
`Points` bigint(20) DEFAULT 0,
`Amount` decimal(19,4) DEFAULT 0.0000,
`ImageID` bigint(20) DEFAULT 0,
`ImageDate` timestamp NULL DEFAULT current_timestamp(),
`GuidID` varchar(100) DEFAULT NULL,
`Frequency` int(11) DEFAULT 3,
`NumRecurrence` int(11) DEFAULT 0,
`NoEnd` tinyint(1) DEFAULT 0,
`DefaultCost` decimal(19,4) DEFAULT 0.0000,
`SkipPrompt` tinyint(1) DEFAULT 0,
`UseScaleWeight` tinyint(1) DEFAULT 0,
`SaleOnline` tinyint(1) DEFAULT 0,
`PackageWeight` decimal(19,4) DEFAULT 0.0000,
PRIMARY KEY (`ProductIndex`),
KEY `prdID` (`ProductID`,`Version`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8
这是INI文件(my.ini位于mysql文件夹中):
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name dbserver generated for @plazsoft.com at 2017-01-14 18:20:14
[mysql]
# CLIENT #
port = 3306
socket = /tmp/mysql.sock
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /tmp/mysql.sock
pid-file = C:/Program Files/MariaDB 10.1/data/mysql.pid
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
skip-name-resolve
sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
sysdate-is-now = 1
innodb = FORCE
# DATA STORAGE #
datadir = C:/Program Files/MariaDB 10.1/data
# BINARY LOGGING #
log-bin = mysql-bin
expire-logs-days = 14
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 2
query-cache-size = 128M
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 256
# INNODB #
innodb-log-files-in-group = 2
innodb-log-file-size = 512M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 2G
# LOGGING #
log-error = C:/Program Files/MariaDB 10.1/data/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = C:/Program Files/MariaDB 10.1/data/mysql-slow.log