0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

マリアDBでテーブル作成時のエラー「there can be only one auto column and it must be defined as a key mariadb」

Posted at

マリアDBでテーブル作成時のエラー

下記のエラーが出て単純なSQLでテーブルが作成できませんでした。

there can be only one auto column and it must be defined as a key mariadb

どうやらオートインクリメント属性には、「primary key」を追加しないといけないらしい。

CREATE TABLE `trading_environment` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

「unique key」でもいいらしい。
下記のように単純にすればいいみたいです。

CREATE TABLE `trading_environment` (
  `id` int(11) unsigned AUTO_INCREMENT primary key NOT NULL,
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?