do it like this:
in the application, kick users of d1 out
create database d2
foreach t in d1:
RENAME TABLE d1.t TO d2.t
tell user to use d2
?
tom
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch
Other way around.
Assuming the aplcation is expecting your table to be named 'db.table1'
and your replacement is newdb.table1 you can do the following.
create a database for hold archives
CREATE olddb;
then
RENAME TABLE
db.table1 to olddb.table1, -- back up the current table
newdb.table1
I'm trying to rename some tables for archival, but the table renaming
is failing when I use CONCAT() to form the table string name:
mysql RENAME TABLE flows TO flows_tmp, flows_new TO flows, flows_tmp
TO CONCAT(flows_, DATE_SUB(CURDATE(), interval 1 day));
ERROR 1064: You have an error in your
At 8:12 -0400 5/28/05, Jason Dixon wrote:
I'm trying to rename some tables for archival, but the table
renaming is failing when I use CONCAT() to form the table string
name:
CONCAT() produces a string, not an identifier.
mysql RENAME TABLE flows TO flows_tmp, flows_new TO flows,
flows_tmp
On May 28, 2005, at 8:51 AM, Paul DuBois wrote:
At 8:12 -0400 5/28/05, Jason Dixon wrote:
I'm trying to rename some tables for archival, but the table renaming
is failing when I use CONCAT() to form the table string name:
CONCAT() produces a string, not an identifier.
Fine. Is there any
At 11:00 -0400 5/28/05, Jason Dixon wrote:
On May 28, 2005, at 8:51 AM, Paul DuBois wrote:
At 8:12 -0400 5/28/05, Jason Dixon wrote:
I'm trying to rename some tables for archival, but the table
renaming is failing when I use CONCAT() to form the table string
name:
CONCAT() produces a
Hi,
As Paul said, since concat gives a string, you can use this fact in preparing
statement (v4.1). This works fine for me :
But use replace to change '-' to '_' in the table_name.
set @tt:=concat('rename table flows_2005_05_27 to ',CONCAT(flows_,
replace(DATE_SUB(CURDATE(), interval 2 day
'-' to '_' in the table_name.
set @tt:=concat('rename table flows_2005_05_27 to ',CONCAT(flows_,
replace(DATE_SUB(CURDATE(), interval 2 day),'-','_')),';');
select @tt;
mysql show tables like 'flow%';
+-+
| Tables_in_world (flow%) |
+-+
| flows_2005_05_27
Is it possible to rename a MySQL table? If so, how?
If not, is there a simple query syntax to copy a table?
I don't have access to the command-line version,
just a web interface, and no, not anything nice like PhpMyAdmin! :-(
--
Mark Wilson, Computer Programming Unlimited (cpuworks.com)
Web :
If you use PHP
program like below...
?
$conn = mysql_connect($host,$user,$pass)
if(!$conn) exit;
mysql_select_db($dbname);
$query = rename table old_table to new_table;
$res = mysql_query($query, $conn);
if(!$res) {
echo(Rename table failed);
exit;
}
echo(Rename table successfully
Jannie,
- Original Message -
From: Jannie Qu [EMAIL PROTECTED]
Newsgroups: mailing.database.mysql
Sent: Tuesday, January 21, 2003 1:30 AM
Subject: Is rename table to another database safe for INNODB tables
sql, query,
Hi, all,
As you may knew, mysql will implement rename database
sql, query,
Hi, all,
As you may knew, mysql will implement rename database in version 4.1
Right now, I need to rename a database, what I plan to do is rename each
table (INNODB type, version 3.23.53 on MAC OS) to another new database.
RENAME TABLE current_db.tbl_name TO new_db.tbl_name;
Do
Hi!
The following might fix Pete's RENAME TABLE bug:
...
August 12, 2002:
If you ran in the AUTOCOMMIT mode, executed a SELECT, and immediately after
that a RENAME TABLE, then RENAME would fail and MySQL would complain about
error 1192 'Can't execute the given command because you have active
Lutz,
- Original Message -
From: Lutz Maibach [EMAIL PROTECTED]
To: Heikki Tuuri [EMAIL PROTECTED]
Sent: Tuesday, August 13, 2002 5:09 PM
Subject: Re: Rename Table in Replication failed / command missing in slave
log
Hi Heikki,
Lutz' problem looks like somethig different
Hi,
today I noticed a strange behaviour in MySQL 3.23.49a-Replication I can't explain.
A perl-script which controls whether master- and replication-tables are equal showed
me, that a master-table was missing on both slaves (two backups are better than one
:-) )
When I controlled the master
If you're using InnoDB tables, replication stops the slaves from
running. Heikki said he'd try to get this fixed for 3.23.52.
--Pete
On Mon, Aug 12, 2002 at 04:05:11PM +0200, Lutz Maibach wrote:
Hi,
today I noticed a strange behaviour in MySQL 3.23.49a-Replication I can't explain.
A
I'm using MySQL-3.23.49a
I use MySQL to replace plain text log files. The logging happens in a
table named current.
Every midnight, at 00:00:00, i perform a table rotation with this
command from a cron job:
CREATE TABLE new
RENAME TABLE current TO $date, new TO current
where $date
Hi,
I just run into a problem.
RENAME TABLE put_tablename_here TO another_tablename here
is not replicated. But a
ALTER TABLE RENAME put_tablename_here TO another_tablename here
is replicated.
Is this a feature, or do I something wrong ?
Regards
PS (Filter): Mysql is the greatest
hallo
i want to change the name of a table. what must i do?
--
Gruß bye
Michael Ott
-
- Siemens AG - IS IT PS 51 ERL -
- Werner-von-Siemens-Strasse 60 -
- 91050 Erlangen-
- Tel. +49 91 31 7 42 0 54 -
- [EMAIL PROTECTED] -
In the last episode (Jun 27), Michael Ott said:
hallo
i want to change the name of a table. what must i do?
http://www.mysql.com/doc, enter rename table, hit search:
http://www.mysql.com/doc/R/E/RENAME_TABLE.html
Before posting, please check:
http://www.mysql.com/manual.php
Try this;
ALTER TABLE old_table_name RENAME TO new_table_foobar
\david
-Original Message-
From: Michael Ott [mailto:[EMAIL PROTECTED]]
Sent: den 27 juni 2001 09:19
To: MySQL-Mailing-List
Subject: rename table
hallo
i want to change the name of a table. what must i do
21 matches
Mail list logo