Rename INDEX Column

Posted by Lee on Stack Overflow See other posts from Stack Overflow or by Lee
Published on 2010-05-27T19:50:03Z Indexed on 2010/05/27 19:51 UTC
Read the original article Hit count: 164

Filed under:
|
|

Hey All

I have a database with around 40 tables and need to rename every index column.

IE USER a table has a bunch of fields like

user_id | user_username | user_password | etc...

I want to rename the ID columns just to id ie

id | user_username | user_password | etc...

But I keep getting mysql errors on the alter table command ie.

ALTER TABLE database RENAME COLUMN user_id to id;

Plus many different variations.

Whats the best way to do this ?

Hope you can advise

© Stack Overflow or respective owner

Related posts about mysql

Related posts about primary-key