简体   繁体   English

ALTER TABLE table_name AUTO_INCREMENT = 1000; 给我语法错误

[英]ALTER TABLE table_name AUTO_INCREMENT = 1000; gives me syntax error

this is my table export: 这是我的表导出:

CREATE TABLE IF NOT EXISTS `order` (

  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,

  `comment` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `shipping_cost` double DEFAULT NULL,

  `customer_id` int(11) NOT NULL,

  `delivery_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,

  `invoice_nr` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,

  `created_at` timestamp NULL DEFAULT NULL,

  `updated_at` timestamp NULL DEFAULT NULL,

  `deleted_at` timestamp NULL DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `order_customer_id_index` (`customer_id`),

  KEY `order_invoice_nr_index` (`invoice_nr`),

  KEY `order_created_at_index` (`created_at`),

  KEY `order_updated_at_index` (`updated_at`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

when I run now: 当我现在运行时:

ALTER TABLE order AUTO_INCREMENT=1000;

I get: 我得到:

#1064 - You have an error in your SQL syntax; #1064-您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order AUTO_INCREMENT=1000' at line 1 检查与您的MySQL服务器版本对应的手册以获取正确的语法,以在第1行的“ order AUTO_INCREMENT = 1000”附近使用

the table is empty! 桌子是空的!

mysql version: 5.5.44-0ubuntu0.14.04.1 mysql版本:5.5.44-0ubuntu0.14.04.1

someone has an idea what could cause me this problem? 有人知道什么可能导致我这个问题?

if I put for example this: 如果我举这个例子:

ALTER TABLE asdasdfasdfasdf AUTO_INCREMENT=1000;

I get 我懂了

1146 - Table 'mydb.asdasdfasdfasdf' doesn't exist 1146-表'mydb.asdasdfasdfasdf'不存在

Try: 尝试:

ALTER TABLE `order` AUTO_INCREMENT=1000;

Order is a reserved word, it's trying to order... 订单是保留字,它正在尝试订购...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM