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
https://dev.mysql.com/doc/refman/5.7/en/symbolic-links-to-databases.html says
MySQL does not support linking one directory to multiple databases.
You can use symbolic links to link a database directory to some other location, for example outside the datadir.
$ cd /var/lib/mysql
$ ln -s /other/dir/mydatabase .
But you can't use symbolic links to make one database directory an "alias" for another MySQL database:
$ cd /var/lib/mysql
$ ln -s `pwd`/mydatabase1 mydatabase2 # WRONG
The reason is that InnoDB retains database names and other metadata inside its own data dictionary, stored in the tablespace file. If you confuse it, you won't get what you want.
MySQL doesn't have any DDL syntax for aliasing a database.