查看建表时间
How do I get the creation date of a MySQL table?
SELECT create_time FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'your_schema' AND table_name = 'your_table'
修改自增起始值
How to set initial value and auto increment in MySQL?
ALTER TABLE "table_name" AUTO_INCREMENT = 1000;
添加主键
mysql – Insert auto increment primary key to existing table – Stack Overflow
ALTER TABLE tbl ADD id INT PRIMARY KEY AUTO_INCREMENT;
复合主键
primary key(name, age)
处理 Expression #1 of SELECT list is not in GROUP BY clause 问题
mysql 命令 gruop by 报错 this is incompatible with sql_mode=only_full_group_by_记忆碎片-CSDN 博客
临时处理:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
彻底解决:修改 my.ini 配置:
[mysqld] ... SET sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; ...