Rename Database - Why Would This Not Work?
Rename Database - Why Would This Not Work?
am 21.11.2009 18:38:29 von Eric.Robinson
------_=_NextPart_001_01CA6AD1.704BA478
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I used a simple procedure to rename my MySQL 4.1.22 database, which has
only My-ISAM tables:
=20
1. Stopped MySQL
2. Renamed the database directory from olddbname to newdbname
3. Started mysql
=20
At this point, I grepped for 'olddbname' and found that many of the old
..MYI files still had references to 'olddbname'. So I...
=20
4. Did mysqlcheck -o newdbname
=20
Then all the references to 'olddbname' were removed from the index
files.
=20
I then started our application and everything seems to be working fine
using the new database name. Yet I'm still worried because when I Google
it, I see people talking about lots of different ways to do a database
rename, and people are making it sound like a complicated, dangerous
procedure.
=20
Why would my simple approach not work? Should I be watching for
potential problems down the road because I did it this way?
=20
--
Eric Robinson
Director of Information Technology
Physician Select Management, LLC
775.885.2211 x 111
=20
------_=_NextPart_001_01CA6AD1.704BA478--
RE: Rename Database - Why Would This Not Work?
am 23.11.2009 15:17:23 von Eric.Robinson
>RENAME TABLE
> olddb.table1 TO newdb.table1,
> olddb.table2 TO newdb.table2
>put the whole list in here, the whole statement will be applied to the
system atomically=20
The database has 1200+ tables, so your approach seems like more work to
me. As it is, all I'm doing is:
service mysql stop
mv olddb newdb
service mysql start
mysqlcheck -o newdb =20
--
Eric Robinson
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Rename Database - Why Would This Not Work?
am 23.11.2009 15:37:08 von Jim Lyons
--0016e6d77ed39af3ea04790ac285
Content-Type: text/plain; charset=ISO-8859-1
Does this work if any of the tables are InnoDB?
On Mon, Nov 23, 2009 at 8:17 AM, Robinson, Eric wrote:
> >RENAME TABLE
> > olddb.table1 TO newdb.table1,
> > olddb.table2 TO newdb.table2
>
> >put the whole list in here, the whole statement will be applied to the
> system atomically
>
> The database has 1200+ tables, so your approach seems like more work to
> me. As it is, all I'm doing is:
>
> service mysql stop
> mv olddb newdb
> service mysql start
> mysqlcheck -o newdb
>
>
> --
> Eric Robinson
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=jlyons4435@gmail.com
>
>
--
Jim Lyons
Web developer / Database administrator
http://www.weblyons.com
--0016e6d77ed39af3ea04790ac285--
Re: Rename Database - Why Would This Not Work?
am 23.11.2009 15:37:32 von Johan De Meersman
--0016e6475b20062cfa04790ac4c4
Content-Type: text/plain; charset=ISO-8859-1
You don't even need to stop the server afaik. As mentioned previously,
though, works for MyISAM only.
On Mon, Nov 23, 2009 at 3:17 PM, Robinson, Eric wrote:
> >RENAME TABLE
> > olddb.table1 TO newdb.table1,
> > olddb.table2 TO newdb.table2
>
> >put the whole list in here, the whole statement will be applied to the
> system atomically
>
> The database has 1200+ tables, so your approach seems like more work to
> me. As it is, all I'm doing is:
>
> service mysql stop
> mv olddb newdb
> service mysql start
> mysqlcheck -o newdb
>
>
> --
> Eric Robinson
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=vegivamp@tuxera.be
>
>
--0016e6475b20062cfa04790ac4c4--
Re: Rename Database - Why Would This Not Work?
am 23.11.2009 20:47:55 von Rob Wultsch
--000e0cd5c08062182804790f1ff9
Content-Type: text/plain; charset=ISO-8859-1
On Mon, Nov 23, 2009 at 7:37 AM, Johan De Meersman wrote:
> You don't even need to stop the server afaik. As mentioned previously,
> though, works for MyISAM only.
>
While this is strictly true there are some big caveats (flushing tables,
etc). It is safer to shut down the database before moving files around.
--
Rob Wultsch
wultsch@gmail.com
--000e0cd5c08062182804790f1ff9--