Forums / Installing on a Linux/Unix Server / Importing Database into new Installation

Importing Database into new Installation

Locked

Views: 8,804

Results 1 to 20 of 28
This thread is locked. New replies are disabled.
14 Dec 2007, 2:03 PM
#1
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Importing Database into new Installation

Hello,

I am in the process of changing hosting company's. I have installed Zencart on new server and have imported the database.

The problem is that when I go to "MYDOMAIN.COM/CART" it does not display any of the catalogue information. Just a blank Zencart Installation.

When I view the database from phpadmin, all of the data is there but is not displaying.

I did the exact same thing for another one of my domains and it worked flawlessly with no trouble. What could be the problem with this as this is my most important and largest catalog.

Thanks so very much for your help.

Kevin

Thank you, Sincerely, MagicMan

14 Dec 2007, 2:59 PM
#2
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Importing Database into new Installation

Did you change the 2 configure.php files?

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

14 Dec 2007, 3:02 PM
#3
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

Thanks for the quick reply.

The important thing is that my data is there. I think what might be the problem is that I am stuck in DNS propagation. Long story. I will wait another day or so and try it again.

I will also check the configure files, thanks for the suggestion and post a reply back once I figured this out with the fix.

Be in touch soon.

Thanks again.
Kevin

Thank you, Sincerely, MagicMan

14 Dec 2007, 3:04 PM
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Importing Database into new Installation

If you need more help, be sure to post your link.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

14 Dec 2007, 3:27 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

Have you correctly pointed the new install to the new database?
And have you used the same DB_PREFIX as you had on the old server?

FAQ on moving from one server to another: https://www.zen-cart.com/tutorials/index.php?article=100

.
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.

14 Dec 2007, 3:41 PM
#6
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

It is a long story.

The new Zencart install was automatic via the cpanel. Worked great.

It automatically names the database which is fine because it is the new name for the database that I would like to use. DB Name is "zc_1"

I had already imported this data into another Zencart Installation using my own defined database name. DB Name "HHD_STORE"

I imported "HHD_STORE" DB into "zc_1" DB. The import went smoothly and there wer no error message.

This is where I get confused. When I view the new "zc_1" DB from phpmyadmin, all of the data is there. Catagories, product info etc etc. However, when I try to access the cart from "MyDomain.com/cart" it shows the Zencart program but none of the data from the database.

I checked the config files and the DB is "zc_1" I changed it to "HHD_STORE" but nothing happened.

This is redundent from my first post but maybe clarifies it a bit.

Thank you, Sincerely, MagicMan

14 Dec 2007, 3:43 PM
#7
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

Please post all the DB_xxxxxx settings from your OLD store and your NEW store here. The password can be skipped.

.
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.

14 Dec 2007, 3:56 PM
#8
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

DrByte:

Please post all the DB_xxxxxx settings from your OLD store and your NEW store here. The password can be skipped.

Please excuse my ignorance but I am still a beginner with Zencart.

Where would I find the DB_xxxxx settings?

Thank you, Sincerely, MagicMan

14 Dec 2007, 4:13 PM
#9
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

One of the other changes that I made was the path to the cart. The original one is "store" and the new one is "cart". Would this make a difference?

Thank you, Sincerely, MagicMan

14 Dec 2007, 4:21 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

I was referring to these, from your configure.php files:```
// define our database connection
define('DB_TYPE', '');
define('DB_PREFIX', '');
define('DB_SERVER', '');
define('DB_SERVER_USERNAME', '');
define('DB_SERVER_PASSWORD', '');
define('DB_DATABASE', '');

.
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.

14 Dec 2007, 4:22 PM
#11
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

MagicMan:

One of the other changes that I made was the path to the cart. The original one is "store" and the new one is "cart". Would this make a difference?

The "path" has no bearing on the product data displayed.

.
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.

14 Dec 2007, 4:37 PM
#12
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

The Old Config - Exported:
// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', '');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'paragon1');
define('DB_SERVER_PASSWORD', 'xxxxxxx');
define('DB_DATABASE', 'paragon1_HHDSTORE');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', 'db'); // use 'db' for best support, or '' for file-based storage

The new Config - Imported:
// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', 'zen_');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'hhetc_zc1');
define('DB_SERVER_PASSWORD', 'xxxxxxxxx');
define('DB_DATABASE', 'hhetc_zc1');
define('USE_PCONNECT', 'false'); // use persistent connections?
define('STORE_SESSIONS', 'db'); // use 'db' for best support, or '' for file-based storage

Again, all of the data is in the imported database and viewable via phpmyadmin. The store does not display the contents when viewed though.

Thank you, Sincerely, MagicMan

14 Dec 2007, 4:59 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

MagicMan:

Again, all of the data is in the imported database and viewable via phpmyadmin. The store does not display the contents when viewed though.

Right, and that's to be expected, since you've got it pointing to the wrong tables in your database:

MagicMan:

The Old Config - Exported:
define('DB_PREFIX', '');

The new Config - Imported:
define('DB_PREFIX', 'zen_');

a) Your old database has no "prefixes" on the table names.
b) Your new database has "zen_" as a prefix before each table name.
c) If you imported the "old" database w/o prefixes into your "new" database, you'll see that you have two sets of tables ... one w/o prefixes, and one with.
Just scroll down the list of tables, and you'll see a complete extra set that start with "zen_".

So, you need to do two things:

  1. edit your 2 configure.php files, and set the DB_PREFIX to '' (two single quotes)

  2. use phpMyAdmin and manually delete all the tables starting with "zen_".
    Be careful you don't delete other tables starting with the letter Z by mistake.

.
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.

14 Dec 2007, 6:38 PM
#14
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

Is there a way that I can do the opposite. Transfer the empty table with the data and rename it to Zen, so that I do not have to go through this again in the future and because I also have 2 other sites that are configured properly and I would like to keep everything symetrical and easy to use.

Thank you, Sincerely, MagicMan

14 Dec 2007, 6:51 PM
#15
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

If you learn how to do installs on your own, you'll be able to set up new sites as you want them to be.

I recommend not using "zen_" prefixes. "No prefix" is much less complicated.

I'm not sure what's "complicated" about correcting the DB_PREFIX to match what's needed in your database ... esp since you've got to edit the configure.php files for a move anyway.

.
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.

14 Dec 2007, 7:05 PM
#16
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

I got it.

Yes, I do know how to do a manual installation it just seemed so much easier to do it through CPanel.

Can I just FTP a backup copy of the original install to my new server?

If I do this I think I still need to load the Install file and do an installation over before I import the database. Yes?

Bye the way, thank you for taking the time to discuss this with me it is greatly appreciated..

Thank you, Sincerely, MagicMan

14 Dec 2007, 7:20 PM
#17
drbyte avatar

drbyte

Sensei

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

Re: Importing Database into new Installation

MagicMan:

Can I just FTP a backup copy of the original install to my new server?

If I do this I think I still need to load the Install file and do an installation over before I import the database. Yes?

Much like the FAQ I referenced earlier, yes.

  1. FTP the files to the server
  2. PROTECT ... make a backup of ... BOTH configure.php files, and mark the uploaded ones as read-write
  3. Ensure that the zc_install folder is also uploaded (and matches the version of the Zen Cart files you're using)
  4. Run zc_install to set up the database and build configure.php files specific to the new server, being sure to use the same DB_PREFIX.
  5. Import the database backup into the new database.
  6. Login to the admin and fix the session directory, as per the FAQ.

Basically ... just follow the FAQ :)

.
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.

15 Dec 2007, 5:28 PM
#18
magicman avatar

magicman

Zen Follower

Join Date:
Oct 2007
Location:
MA, USA
Posts:
385
Plugin Contributions:
0

Re: Importing Database into new Installation

I resolved the issues. Thank you so much for your assistance. Everything is working fine. Everyone in this forum is top knotch and should be proud of yourselves. Outstanding job.

Thread can be closed

Thank you, Sincerely, MagicMan

16 Dec 2007, 5:07 PM
#19
geixa avatar

geixa

New Zenner

Join Date:
May 2007
Location:
Florida
Posts:
18
Plugin Contributions:
0

Re: Importing Database into new Installation

Here's additional info in case it helps someone.

You may or may not consider doing it this way, as you've already begun fidgeting with the configure.php files.... This works well if you are looking to copy over products, categories, customers, attributes, etc. If you are looking to copy the entire database, then you may as well do just that.

With a fresh install of Zencart, here's what I do.

FIRST, DO A BACKUP: in phpMyAdmin. Select your old database that is storing all of your info. Click Export on the top. Click "Select All" (or make sure all the fields in the box are highlighted in the Export box) Leave it as a SQL export type. Check "Save As" and click Go. This makes a SQL backup of your precious database.

THEN: Install Zencart fresh. Link it to an entirely new database.
Say the original was called Zen1.
Call the new install database Zen2 (created of course before the install)
You'll have 93 tables by default in your new installed database, but no products or categories, right?

In phpMyAdmin, click on your old database. Click products. Click Operations. Somewhere there you will see "Copy table to (database**.**table):"
In the drop down, select the new database name as that's where you want to copy to.
In the empty text field after the . type the word products
NOTE: what you type in this field must match exactly the name of the table you are copying.
Click "data only". (as you only want the data. The structure means the "table" itself & that already exists.)
Click "go"
The product data will be copied.
NOTE: If you have existing data in your product table in your new database because you added a product to test it out or whatever, you will not be able to copy over data from the old database to the new. It will error.
If the data in the new database in the "product" table is not important, then delete it and make the table empty so it's ready for the copy over process.

To empty a table: Select the database that contains the table.Then click on the table from the list to the right. At the top you can click "Browse" just to take a look at what's in there to make sure you are cool with deleting it. If so, Click "Empty" at the top. Say Ok to any prompting. Then the table will be empty & you can copy data to it no problem.

To copy over products & categories from an old database to a new database,
you need to copy over AT LEAST these 5 tables:
products
products_description
products_to_categories
categories
categories_description

IF your products had attributes, then you also need to copy over these tables as well:
products_attributes
products_options
products_options_values
products_options_values_to_products_options

If you want to copy the entire database over, even easier.
Make sure you have the backup from above. Make 2 backups if you're totally concerned.

Next destroy the new databse you just installed the ZenCart to, in my example above "zen2"
How to do that: if you don't have a "destroy" option in PhpMyAdmin (next to "Empty" up top), then in your MySql server, delete the databse zen2 (the NEW one, NOT the one holding your databse). Re-create a database again WITH THE EXACT SAME NAME. I mean exact. Now you have a totally empty databse called Zen2.
Go back to phpMyAdmin. Click the new (now empty) database "Zen2". Clck "Import" from the top. Browse to your SQL backup. Click go. It may take a few seconds & voila. There it is.

If you need further assistance, just ask. I am very familiar with importing / exporting to zencart.
hope this helps.

20 Feb 2008, 9:25 AM
#20
heavenlynights avatar

heavenlynights

Zen Follower

Join Date:
Jan 2006
Location:
Australia
Posts:
303
Plugin Contributions:
0

Re: Importing Database into new Installation

Hi there

Just starting this thread again as I have a simple question which I hope that someone will be able to help me with. My question is in regard to the this thread however, I need to know;

if i can import a database which is for zen version 1.3.7.1 into a database for a fresh install of zen version 1.3.8a?

If this is possible, I am guessing that i would have to re-upload the zc_install directory for version 1.3.8a and then run the install and choose update database.

Could someone please be kind enough to either confirm my thoughs or correct me if I am wrong.

Waiting in anticipation

Cheers Heavenlynights
http://www.heavenlynightslingerie.com.au
Warning: Adult Content - Zen 1.3.8a