Jump to content

Archived

This topic is now archived and is closed to further replies.

OriginalSunny

syntax for changing column name

Recommended Posts

Hi,
I need to know how to change the name of some columns in my database. I would also like to change the name of my database. All of this without altering data stored in the database or dropping anyhing. If you know the syntax to do this please let me know. Thanks.

Share this post


Link to post
Share on other sites
ALTER TABLE will change table and column names, ALTER DATABASE will change database name... See the documentation at www.mysql.com for more details.

Share this post


Link to post
Share on other sites
To change a column name:

[code]ALTER TABLE yourTable CHANGE COLUMN yourOldColumn yourNewColumn <column details>[/code]

To rename a DB, you really need to shutdown the server, rename the actual directory itself, and then handle all the privileges. I don't think there's another way, though I think 5.1 will have a RENAME DATABASE command.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.