---
title: "mysql 字段操作"
author: "TimerBin"
date: "2015-01-08T20:24:17Z"
tags: []
slug: "mysql"
draft: false
lastmod: "2015-01-08T20:24:17Z"
id: 2174112
url: "https://timerbin.iteye.com/blog/2174112"
---

一、修改Mysql 字段类型

```
alter table t_orm_timerorm modify column t_name varchar(255);
```

 

二、修改mysql字段为自增字段

```
create table t_orm_timerorm(
    id bigint  primary key,
    t_name varchar(255)
}
--需要定义自增键为一个主键
alter table t_orm_timerorm modify id bigint auto_increment ;  
否则会出现如下错误：（具体为什么还未查出）
 1075. Incorrect table definition; 
      there can be only one auto column and it must be defined as a key
```