Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

in MySQL5.1, is there a way to make one table accessible by two different names? I'm thinking about somethink like a symlink on linux filesystems.

I know theres the

CREATE VIEW myview AS SELECT * FrOM mytable

thing, but I don't only need to SELECT from both names, but also delete etc ...

You might ask why I want to do this? It's about getting a commercial, closed-source app to work, which is crappily programmed (usually, the table names are all lower-case, but occasionally, they use capitalized names for the same table ...). Oh, that would be another idea: Is there a way to tell MySQL not to care about capitalization of table names (like on Windows filesystems?)? that would also do the trick ...

... found the answer: lower_case_table_names, a variable. Since this is the solution to my problem, but not the answer to my question (which is still interesting), i don't answer my own question yet ...

Thanks for your insight!

A.

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

Consider looking into the lower_case_table_names system variable.

share|improve this answer
    
thanks, just found out about that. is there a way to only set that per database? –  andreas-h May 22 '10 at 19:43
    
Unfortunately no. –  Ignacio Vazquez-Abrams May 22 '10 at 19:43
add comment

An abstraction layer like MySQL Proxy could help here.

share|improve this answer
add comment

You can create updatable views in mysql 5.0, it seems. Check here, and search the page for 'updatable'.

I'm not a mysql innards expert, but I imagine that simply symlinking or hard-linking will end in madness. mysql probably caches table file state by filename, and if 2 files are pointing @ the same data, you may end up in a situation where mysql will change the data file at one 'name', but not the other, resulting in flagrant corruption.

share|improve this answer
add comment

I think mysql's Federated tables could be an answer to your underlying question. Not the best performance, but I think that if you created a federated table which points to the existing table on localhost it would work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.