MariaDB [test]> create table test1(id int primary key auto_increment,name varchar(20))auto_increment=1; #id为自增主键,默认从1开始递增
Query OK, 0 rows affected (0.07 sec)
MariaDB [test]> insert into test1 values(null,'linux'); #注意,需要null,否则列数不对应mysql会报错
Query OK, 1 row affected (0.01 sec)
MariaDB [test]> insert into test1 values(null,'linux2');
Query OK, 1 row affected (0.00 sec)
MariaDB [test]> insert into test1 values(null,'linux3');
Query OK, 1 row affected (0.00 sec)
MariaDB [test]> select * from test1;
+----+--------+
| 1 | linux |
| 2 | linux2 |
3 rows in set (0.05 sec)
MariaDB [test]>