MariaDB [studio]> CREATE TABLE goods_( -> id INT PRIMARY KEY SERIALS, -> remark VARCHAR(100) -> ) ENGINE INNODB; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' remark VARCHAR(100) ) ENGINE INNODB' at line 2
时间: 2023-10-16 17:31:59 浏览: 29
在这个 SQL 语句中,您需要将 "SERIALS" 更改为 "AUTO_INCREMENT",因为 MariaDB 不支持 "SERIALS" 这个关键字。尝试使用以下 SQL 语句来创建表:
```
CREATE TABLE goods_(
id INT PRIMARY KEY AUTO_INCREMENT,
remark VARCHAR(100)
) ENGINE=InnoDB;
```
这应该能够成功创建一个名为 "goods_" 的表,其中包含一个自增的 "id" 列和一个 "remark" 列。
相关问题
create table school( id int unsigned auto_increment, school_id int not null, grade_name varchar(100) not null, primary key(id), ) ENGINE=INNODB DEFAULT CHARSET=utf8 > 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ENGINE=INNODB DEFAULT CHARSET=utf8' at line 6 > 时间: 0s
这个错误是由于在创建表 "school" 时存在语法错误导致的。根据错误消息,问题可能出现在第 6 行附近。
在你的创建表语句中,需要移除最后一个逗号(,),它位于 "primary key(id)," 这一行的末尾。修改后的语句如下所示:
```sql
create table school(
id int unsigned auto_increment,
school_id int not null,
grade_name varchar(100) not null,
primary key(id)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
```
请注意,我已经移除了最后一个逗号,并且将分号(;) 放在语句的末尾。现在,你可以执行这个修正后的语句来创建名为 "school" 的表。
MARIADB_EXTRA_FLAGS --wait_timeout
MARIADB_EXTRA_FLAGS 是 MariaDB 服务器启动时的附加选项,用于配置一些高级设置。而 --wait_timeout 是其中一个选项,它指定了当一个连接空闲时间超过指定的秒数后,服务器关闭连接的时间。可以通过设置该选项来避免不必要的连接占用数据库资源,提高数据库的性能。例如,以下命令将 MariaDB 的 wait_timeout 设置为 600 秒:
```
MARIADB_EXTRA_FLAGS="--wait_timeout=600"
```
这将在启动 MariaDB 时将 wait_timeout 设置为 600 秒。