Forums / Installing on a Windows Server / Trouble importing old database

Trouble importing old database

Started by countingsheep on 7 Oct 2011, 4:13 AM · Views: 2,735

Results 1 to 12 of 12
7 Oct 2011, 4:13 AM
#1
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Trouble importing old database

relevant info:
--Most current version of zen cart installed on new server
---PHP Version information: 3.4.5
---mysql:
Server: Localhost via UNIX socket
Server version: 5.0.92-community
Protocol version: 10---web server
cpsrvd 11.30.4.6
MySQL client version: 4.1.22
PHP extension: mysql
History: website needs upgraged, but server that it is on, is terrible. My attempt is to set up the site on a new server:

I am working on a site that is on one of the worst servers I have ever had experience with. I am not even able to get the zc_install to open on the server after loading it because the server has put up a warning.. It took me 3 hours to do a backup of the site and its a small site. :( Only like 300 products?
So, we are moving her site to a better server.. and I installed the most current version of zen cart by following the upgrade instructions, but, it keeps stalling on trying to load her old database. I tried breaking the database apart and loading just sections of it at a time and Im getting this error when adding products descriptions:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[value-1],[value-2],[value-3],[value-4],[value-5],[value-6])
(13, 1, 'Organic Ju' at line 1

Can anyone suggest what to do in that case, or can they suggest how to upgrade the database? When I ran the zc_install, it didnt ask about upgrade for database? It just gave me the option to do the install? I cant load the entire database by itself for some reason?

7 Oct 2011, 5:05 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trouble importing old database

countingsheep:

but, it keeps stalling on trying to load her old database.THAT is the problem you must resolve.> countingsheep:

I tried breaking the database apart and loading just sections of it at a time and Im getting this error when adding products descriptions:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[value-1],[value-2],[value-3],[value-4],[value-5],[value-6])
(13, 1, 'Organic Ju' at line 1
That suggests you're breaking the statements apart incorrectly.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Oct 2011, 8:01 PM
#3
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

Ok, so, based on your info, then my best approach is to break apart the database and load it? Sorry for my uneducated terminology. Just trying to learn is all.

7 Oct 2011, 8:19 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trouble importing old database

Well, whatever you need to do to reload the data.
If that means breaking it up into multiple statements, then that's what you'll need to do.

You could try re-exporting the original database with "Complete Inserts" enabled but "Extended Inserts" turned off. The resulting export file will be much larger, but splitting up inserts will be much simpler.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Oct 2011, 1:28 PM
#5
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

Thanks, I see where that made a difference but, what does this mean:
#1062 - Duplicate entry '1' for key 1
every section I try gives me that..

8 Oct 2011, 1:38 PM
#6
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

Ignore my question I understand what I did now. I installed the cart, and it created a database and I was trying to load the database that had not been updated into it. So, I am creating another database with the old non upgraded database in it and I will run the install again and select the upgrade database option. :) that should work!

8 Oct 2011, 5:33 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trouble importing old database

Sounds like when you make your backup you're not telling it to include the "drop table" statements. And that suggests you've not read this tutorial: https://www.zen-cart.com/tutorials/index.php?article=103

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Oct 2011, 6:16 PM
#8
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

You are correct, I did not follow it the last time...

8 Oct 2011, 6:19 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trouble importing old database

The "drop table" line removes the table and all its data. Then the "create table" statement adds the table back. Then the "insert" statements add in data.
If you've already got data in the table when it attempts to add a record of a matching index/key, you'll get the "duplicate key" error because the table is protecting you from inserting duplicates.
That's why you should use the "drop table" option ... or manually truncate each table by hand first before you start inserting data.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Oct 2011, 4:06 AM
#10
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

I am still struggling with this site... I have attempted to load the entire site as it was on the OLD server to the new one to at least get something functioning, now, I am getting this message:

1146 Table 'muddkids_nonupgradezc.configuration' doesn't exist
in:
[select configuration_key as cfgkey, configuration_value as cfgvalue from configuration]

the configuration table does exist? I dont know what I did wrong there?

12 Oct 2011, 4:07 AM
#11
countingsheep avatar

countingsheep

Zen Follower

Join Date:
Sep 2006
Posts:
154
Plugin Contributions:
0

Re: Trouble importing old database

muddkids_nonupgradezc.zen_address_book OK
muddkids_nonupgradezc.zen_address_format OK
muddkids_nonupgradezc.zen_admin OK
muddkids_nonupgradezc.zen_admin_activity_log OK
muddkids_nonupgradezc.zen_authorizenet OK
muddkids_nonupgradezc.zen_banners OK
muddkids_nonupgradezc.zen_banners_history OK
muddkids_nonupgradezc.zen_categories OK
muddkids_nonupgradezc.zen_categories_description OK
muddkids_nonupgradezc.zen_configuration OK
muddkids_nonupgradezc.zen_configuration_group OK
muddkids_nonupgradezc.zen_counter OK
muddkids_nonupgradezc.zen_counter_history OK
muddkids_nonupgradezc.zen_countries OK
muddkids_nonupgradezc.zen_coupon_email_track OK
muddkids_nonupgradezc.zen_coupon_gv_customer OK
muddkids_nonupgradezc.zen_coupon_gv_queue OK
muddkids_nonupgradezc.zen_coupon_redeem_track OK
muddkids_nonupgradezc.zen_coupon_restrict OK
muddkids_nonupgradezc.zen_coupons OK
muddkids_nonupgradezc.zen_coupons_description OK
muddkids_nonupgradezc.zen_currencies OK
muddkids_nonupgradezc.zen_customers OK
muddkids_nonupgradezc.zen_customers_basket OK
muddkids_nonupgradezc.zen_customers_basket_attributes OK
muddkids_nonupgradezc.zen_customers_info OK
muddkids_nonupgradezc.zen_customers_wishlist OK
muddkids_nonupgradezc.zen_db_cache OK
muddkids_nonupgradezc.zen_email_archive OK
muddkids_nonupgradezc.zen_ezpages OK
muddkids_nonupgradezc.zen_featured OK
muddkids_nonupgradezc.zen_files_uploaded OK
muddkids_nonupgradezc.zen_geo_zones OK
muddkids_nonupgradezc.zen_get_terms_to_filter OK
muddkids_nonupgradezc.zen_group_pricing OK
muddkids_nonupgradezc.zen_languages OK
muddkids_nonupgradezc.zen_layout_boxes OK
muddkids_nonupgradezc.zen_manufacturers OK
muddkids_nonupgradezc.zen_manufacturers_info OK
muddkids_nonupgradezc.zen_media_clips OK
muddkids_nonupgradezc.zen_media_manager OK
muddkids_nonupgradezc.zen_media_to_products OK
muddkids_nonupgradezc.zen_media_types OK
muddkids_nonupgradezc.zen_meta_tags_categories_description OK
muddkids_nonupgradezc.zen_meta_tags_products_description OK
muddkids_nonupgradezc.zen_music_genre OK
muddkids_nonupgradezc.zen_newsletters OK
muddkids_nonupgradezc.zen_nochex_apc_transactions OK
muddkids_nonupgradezc.zen_nochex_sessions OK
muddkids_nonupgradezc.zen_orders OK
muddkids_nonupgradezc.zen_orders_products OK
muddkids_nonupgradezc.zen_orders_products_attributes OK
muddkids_nonupgradezc.zen_orders_products_download OK
muddkids_nonupgradezc.zen_orders_status OK
muddkids_nonupgradezc.zen_orders_status_history OK
muddkids_nonupgradezc.zen_orders_total OK
muddkids_nonupgradezc.zen_paypal OK
muddkids_nonupgradezc.zen_paypal_payment_status OK
muddkids_nonupgradezc.zen_paypal_payment_status_history OK
muddkids_nonupgradezc.zen_paypal_session OK
muddkids_nonupgradezc.zen_paypal_testing OK
muddkids_nonupgradezc.zen_product_music_extra OK
muddkids_nonupgradezc.zen_product_type_layout OK
muddkids_nonupgradezc.zen_product_types OK
muddkids_nonupgradezc.zen_product_types_to_category OK
muddkids_nonupgradezc.zen_products OK
muddkids_nonupgradezc.zen_products_attributes OK
muddkids_nonupgradezc.zen_products_attributes_download OK
muddkids_nonupgradezc.zen_products_description OK
muddkids_nonupgradezc.zen_products_options OK
muddkids_nonupgradezc.zen_products_options_types OK
muddkids_nonupgradezc.zen_products_options_values OK
muddkids_nonupgradezc.zen_products_options_values_to_products_options OK
muddkids_nonupgradezc.zen_products_to_categories OK
muddkids_nonupgradezc.zen_products_with_attributes_stock OK
muddkids_nonupgradezc.zen_project_version OK
muddkids_nonupgradezc.zen_project_version_history OK
muddkids_nonupgradezc.zen_query_builder OK
muddkids_nonupgradezc.zen_record_artists OK
muddkids_nonupgradezc.zen_record_artists_info OK
muddkids_nonupgradezc.zen_record_company OK
muddkids_nonupgradezc.zen_record_company_info OK
muddkids_nonupgradezc.zen_reviews OK
muddkids_nonupgradezc.zen_reviews_description OK
muddkids_nonupgradezc.zen_salemaker_sales OK
muddkids_nonupgradezc.zen_sessions OK
muddkids_nonupgradezc.zen_specials OK
muddkids_nonupgradezc.zen_subscribers OK
muddkids_nonupgradezc.zen_tax_class OK
muddkids_nonupgradezc.zen_tax_rates OK
muddkids_nonupgradezc.zen_template_select OK
muddkids_nonupgradezc.zen_upgrade_exceptions OK
muddkids_nonupgradezc.zen_whos_online OK
muddkids_nonupgradezc.zen_zen_upgrade_exceptions OK
muddkids_nonupgradezc.zen_zones OK
muddkids_nonupgradezc.zen_zones_to_geo_zones OK

12 Oct 2011, 4:37 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trouble importing old database

countingsheep:

now, I am getting this message:

1146 Table 'muddkids_nonupgradezc.configuration' doesn't exist
in:
[select configuration_key as cfgkey, configuration_value as cfgvalue from configuration]

the configuration table does exist? I dont know what I did wrong there?

countingsheep:

muddkids_nonupgradezc.zen_categories OK
muddkids_nonupgradezc.zen_categories_description OK
muddkids_nonupgradezc.zen_configuration OK

"configuration" is entirely different than "zen_configuration".

Looks like your old server used a DB_PREFIX of "zen_", and your new site is using a blank "" instead.

If you're going to import tables from another database, you must make the new DB_PREFIX match whatever was used on the previous server.

Ensure both of your configure.php files has the correct DB_PREFIX setting to match the data you've imported.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.