Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
another_noob

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...