在InnoDB引擎的mariadb-10.3.7
下,我试图具有以下结构:
drop sequence if exists user_account_id_seq;
create sequence user_account_id_seq start with 1 increment by 10;
drop table if exists user_account;
create table user_account (
-- id bigint(20) unsigned not null auto_increment,
id bigint(20) unsigned not null default (next value for user_account_id_seq),
version int(10) unsigned not null,
created_on datetime,
updated_on datetime,
firstname varchar(255) not null,
lastname varchar(255) not null,
password varchar(100),
password_salt varchar(50),
readable_password varchar(50),
email varchar(50) not null,
confirmed_email bit(1) not null check (confirmed_email in (0, 1)),
work_phone varchar(20),
unique key email (email),
primary key (id)
);
但是它不想删除序列:
--------------
drop sequence if exists user_account_id_seq
--------------
--------------
commit
--------------
--------------
create sequence user_account_id_seq start with 1 increment by 10
--------------
ERROR 1050 (42S01) at line 4: Table '`useraccount`.`user_account_id_seq`' already exists
+ /usr/bin/mariadb/install/bin/mysql useraccount --protocol=tcp -h mysql -P 3306 -u root -v
--------------
然后我手动尝试了以下命令,以显示此消息的令人困惑:
MariaDB [useraccount]> create sequence user_account_id_seq start with 1 increment by 10;
ERROR 1813 (HY000): Tablespace for table '`useraccount`.`user_account_id_seq`' exists. Please DISCARD the tablespace before IMPORT
MariaDB [useraccount]> alter table `useraccount`.`user_account_id_seq` discard tablespace;
ERROR 1146 (42S02): Table 'useraccount.user_account_id_seq' doesn't exist