another_noob Posted October 28, 2012 Share Posted October 28, 2012 I have an E-Commerce project (running in local host) with a database named "ecommerce". My project has been working fine until I decided to download Zen Cart so I could peek around in the code. Evidently Zen Cart uses a database named "ecommerce" also. The result was that the Zen Cart database was merged with my database and my tables that had the same names were overwritten with the Zen Cart tables. I didn't think that this was even possible. I looked in the MySQL 2nd edition book for help to prevent this in the future, but didn't find anything that specifically addresses this issue. Now I am dropping the 90 or so extra tables and recreating mine. My question is two fold 1) How do I avoid this in the future 2) Can I rename my database to avoid this in the future. I am using version 5.5.25a. Thanks. Link to comment Share on other sites More sharing options...
Antonio Conte Posted October 29, 2012 Share Posted October 29, 2012 The reason why your tables got dropped, is because Zen used a command like: DROP TABLE IF EXISTS table_name_here; This is standard behavior. The problem should not be related to the database, but to name collisions on tables. You should look into an option called prefix. With prefixing, you add something before all table names. That means you could have "zen_" before all tables related to zen. This is very common, and almost mandatory in many cases. As a general suggestion, always back up your database before running installations like these. 1 Link to comment Share on other sites More sharing options...
another_noob Posted October 29, 2012 Author Share Posted October 29, 2012 Thank You Antonio. Lesson learned. Link to comment Share on other sites More sharing options...
Recommended Posts