Zen Cart Logo
Forums / General Questions / My database is all wrong!

My database is all wrong!

Locked

Views: 2,025

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
17 Dec 2006, 3:04 PM
#1
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

My database is all wrong!

When I installed Zen Cart I selected the option that adds text_ before the name of the database (or so I thought). Well as I'm working on my site I happen to look in phpMyAdmin and noticed that all the tables were created with text_ and also duplicated without text_ for a total of 186 tables!!

My web host doesn't require the text_ before the tables, only before the database name which actually would be the first 8 characters of my username. I think I misunderstood when I installed ZC and read it as before the database name.
Anyhow, now unfortunately for me those are the tables where all my data is being stored :(

I need to somehow delete the appended tables (but first transfer the data), and remove the instruction to add all future data to text_ tables?
Any suggestions on the best (and painless) way to do this?

thanks

17 Dec 2006, 4:31 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: My database is all wrong!

Let's chat first ... :smile:

Why do you think you need a prefix, as in the text_ in your table names?

I am assuming at this moment the text_blah tables are the not upgraded version of your blah tables which is your real data that just hasn't been upgraded yet, correct?

17 Dec 2006, 4:54 PM
#3
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

Re: My database is all wrong!

Hi...

I found out that I did mis-read the instructions when setting up Zen Cart. I just looked again in the install process and this is where I screwed up:

What is the prefix you would like used for database tables? Example: zen_ Leave empty if no prefix is needed.
You can use prefixes to allow more than one store to share the same database.I read it as the database gets it which would make sense since my host appends my username to my databases.

So I guess I need to somehow surgically remove the data from these tables and reinstall the database without the prefix and reapply all my data.

My database is the latest version that was installed (not an upgrade).

I hope all this makes sense :wacko:

thanks

17 Dec 2006, 5:19 PM
#4
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

Re: My database is all wrong!

Just to add, the file I used when I installed was this one:

mysql_zencart.sql 4795 2006-10-20

17 Dec 2006, 5:42 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: My database is all wrong!

Zen Cart has an automatice Installer and Upgrader in /zc_install

You should be using that vs trying to figure out on your own how to upgrade the database ...

Does your old version have Products and Categories and Orders etc. in it?

If you want to remove all the tables that start with text_ you could go to phpMyAdmin and check the checkbox next to each table that starts with text_ and then select Drop Tables ...

This will leave you with only the tables that do not have the prefix on them ...

Before attempting this ... backup ...

Then make sure the 2 configure.php files do not have the prefix defined in them ...

17 Dec 2006, 6:03 PM
#6
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

Re: My database is all wrong!

What do you mean by upgrading the database? I already have the latest, so there is no need. I don't have an old version like you said, this was a brand new install of Zen Cart and the database. I guess when I created the site it duplicated the tables, one with the prefix and one without.

Yes, my database has products, pricing, etc etc... in it. That's why I need suggestions on the best way to handle this.
I guess I'll need to manually (and tediously) copy and paste from the wrong tables to the correct ones, then delete them after. Ughhh...

So the instruction to place data in the prefixed tables come from the configure.php files? Ok, I will fix it there too so from now on the data is going where it is suppose to.

17 Dec 2006, 6:10 PM
#7
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,843
Plugin Contributions:
0

Re: My database is all wrong!

Does it really matter? If the cart is setup to use the tables with "text_" and not the one without. Just delete the tables without the prefix and use it the way its setup. Who would know but you and the cart fuctions fine either way. why put in all the extra work and stress yourself out.

17 Dec 2006, 6:13 PM
#8
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

Re: My database is all wrong!

Ya know I didn't even give that much thought, and it even makes sense.

17 Dec 2006, 6:19 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: My database is all wrong!

If you wish to rename your tables, you can use the installer to do that too. ... mark your configure.php files as writable, upload the zc_install folder, choose Database Upgrade (NOT "Install"), and you'll notice the option fields for renaming tables located at the bottom of the upgrade-versions listing. Remember to mark your configure.php files read-only again when done.

17 Dec 2006, 6:21 PM
#10
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,843
Plugin Contributions:
0

Re: My database is all wrong!

huh, even I didn't realize it was that simple......

17 Dec 2006, 6:37 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: My database is all wrong!

barco57:

huh, even I didn't realize it was that simple......

One of the nifty toys hidden under the hood ... not everybody needs it but man it saves a lotta headaches when they do.

17 Dec 2006, 8:35 PM
#12
spookyghost avatar

spookyghost

New Zenner

Join Date:
Dec 2006
Posts:
46
Plugin Contributions:
0

Re: My database is all wrong!

Thanks Doc. I had to delete all the non prefixed tables first because it was barking about the table already exists, but that was a very small price to pay considering the alternative if I decided to try to fix it manually.

Like you said, great tool to have just in case!

thanks again...