Jump to content
Larry Ullman's Book Forums

My Database Got Merged With Zen Cart'S Database


Recommended Posts

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

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.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...