Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Oct 03, 2023 3:01 pm


Mysql Application & Query Optimization, Questions, Indexes, Bugs.

Author Message
admin
Post  Post subject: MySql rename table  |  Posted: Wed Feb 02, 2011 6:15 pm
Site Admin

Joined: Mon Aug 03, 2009 8:43 am
Posts: 104

Offline
 

MySql rename table

To rename a mysql table from old_name to new_name, command is:
Quote:
mysql> RENAME TABLE old_name TO new_name

_________________
VPSie - SSD VPS servers in AMS-IX, LINX, DE-CIX
https://vpsie.com





Top
admin
Post  Post subject: Re: MySql rename table  |  Posted: Sun Nov 13, 2011 2:01 pm
Site Admin

Joined: Mon Aug 03, 2009 8:43 am
Posts: 104

Offline
If the table's name happens to use special mysql characters ( like percentage char %), enclose the table name as follows:
Code:
mysql> rename table `%TABLE_PREFIX%email` to email;
Query OK, 0 rows affected (0.02 sec)

_________________
VPSie - SSD VPS servers in AMS-IX, LINX, DE-CIX
https://vpsie.com


Top
Darwin
Post  Post subject: Re: MySql rename table  |  Posted: Mon Nov 28, 2011 3:39 am

Joined: Tue Nov 08, 2011 7:57 am
Posts: 3

Offline
You can try to do exact same thing with Information_Schema.Columns table
Something like
select concat('rename table ', column_name, ' to ' , lower(column_name) , ';')
from information_schema.columns where table_schema = 'your_schema_name';


Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "MySql rename table"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Rename MySql table

debuser

1

2348

Fri Oct 08, 2010 1:36 am

sonee4 View the latest post

There are no new unread posts for this topic. Mysql: add column to table

debuser

1

4235

Fri Oct 08, 2010 1:38 am

sonee4 View the latest post

There are no new unread posts for this topic. Mysql add Unique index to a table column

debuser

0

3274

Fri Aug 06, 2010 10:01 am

debuser View the latest post

There are no new unread posts for this topic. Mysql remove column from an existing table

debuser

0

2304

Fri Aug 06, 2010 10:06 am

debuser View the latest post

There are no new unread posts for this topic. MySql doesn't start: libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)

debuser

0

3192

Mon Feb 22, 2010 1:43 pm

debuser View the latest post

There are no new unread posts for this topic. How to use a mysql stored procedure

debuser

1

2317

Tue Nov 22, 2011 1:23 am

Darwin View the latest post

There are no new unread posts for this topic. Mysql: Cleaning binary logs

debuser

1

2740

Tue May 18, 2010 9:45 am

designeru View the latest post

There are no new unread posts for this topic. Mysql change column's default value

debuser

0

2758

Thu Aug 12, 2010 3:43 am

debuser View the latest post

There are no new unread posts for this topic. Mysql drop (remove) unique key

mandrei99

0

2692

Wed Jan 14, 2015 7:53 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Mysql change root password

mandrei99

0

2904

Tue Feb 10, 2015 6:50 pm

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO