tags:

views:

288

answers:

2

I'm looking for a way to alias a database in MySQL. The reason is to be able to rename a live, production database without bringing the system down. I figure I can alias the database to the new name, change and deploy the code connecting to it at my leisure, and eventually remove the old alias.

If there's a better way to accomplish this please let me know.

+3  A: 

Symbolic links.

Bill Karwin
i'd never thought of that! You (well, not *you*, Bill), forget that databases are just files.
nickf
Thanks! I'd considered that but didn't know if it was safe.
Schwern
A: 

INNODB won't work with filesystem symlinks.

I haven't tried it to confirm, but it might work if you use InnoDB with the file-per-table option, instead of a shared tablespace.
Bill Karwin