Databases InterBase (29) MS-SQL (5) mysql (37) Oracle (1)
Exchange Links About this site Links to us 
|
How can I rename table names and column names in mysql
19 comments. Current rating: (6 votes). Leave comments and/ or rate it.
If only a few changes are necessary, you can just go through a web administration tool like phpAdmin.
If you have many names to change, you could write a script (possibly even generate a script by a tool) and execute it like this:
mysql DATABASENAME -uUSERNAME -pPASSWORD <SCRIPTFILE
The script would contain the SQL commands as shown here:
 | |  | | alter table orgs change o_id org_id int(11);
alter table orgs change o_name org_name varchar(64);
rename table orgs organizations;
| |  | |  |
Comments:
| You are on page 1 of 2, other pages: [1] 2 | |
anonymous from United States
|
|
|
|
Exactly what I needed - thanks
|
|
anonymous from India
|
|
|
|
Thanks
|
|
anonymous
|
 |
|
|
|
|
saeid.zebardast@gmail.com from Tehran, Iran
|
 |
|
|
Thanks
|
|
anonymous from Germany
|
|
|
|
thx
|
|
anonymous from United States
|
|
|
|
a good tip.. thanks
|
2008-05-25, 08:18:14 (updated: 2008-05-25, 08:18:41) |
dd from United States
|
 |
|
|
Thanks, helped a lot since I am just learning SQL and using mySQL.
|
|
anonymous from Madras, India
|
|
|
|
perfect
|
2008-10-24, 11:02:39 (updated: 2008-10-24, 11:04:22) |
anonymous from Bangalore, India
|
 |
|
|
Thank you very much
|
|
anonymous from South Africa
|
|
|
|
I'm struggling to rename a column from a table without affecting the data in it using mysql console
|
2009-04-03, 12:29:42 (updated: 2009-04-03, 12:30:29) |
anonymous from Madras, India
|
|
|
|
thanks
|
|
anonymous from Mongolia
|
|
|
|
tnx.I really want to learn mysql prefectly. berikbolt@yahoo.com
|
|
anonymous from India
|
|
|
|
Thanks
|
|
anonymous from Canada
|
|
|
|
go fuckurself fail wrong bullshit on table rename
|
|
anonymous from Mongolia
|
|
|
|
tnx a lot
|
| You are on page 1 of 2, other pages: [1] 2 |
|