Link to home
Start Free TrialLog in
Avatar of Amanda Watson
Amanda WatsonFlag for Australia

asked on

how can I import tables from one database into another database in MySQL

Hi there,
I have  some tables from one database that I would like to import into another database.

I don't want to import the entire database, just some select tables.

In particular I am wanting to import tables from a Virtuemart 1.0 version into a database with Virtumart 1.1 tables...
Can I do this?
Avatar of Plano Tech
Plano Tech
Flag of United States of America image

Here are some tools to help you accomplish this:

http://extensions.virtuemart.net/index.php?option=com_sobi2&catid=12&Itemid=2

-PT
Avatar of Amanda Watson

ASKER

I am trying to use csvimproved but I cannot get it to install in joomla 1.0 so I don't know how to export my vm from 1.0??
ASKER CERTIFIED SOLUTION
Avatar of PranjalShah
PranjalShah
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you have access to phpMyAdmin on your webhost? It is easy to export tables there.
I have access to phpMyAdmin

So I simply select the tables I want to export from my old database and then what with my new database?

The new database already has the tables created, they just don't have the data, so how to I get the data from the old table to the new table?

You can add a SQL to the file in the beginning...

DROP TABLE IF EXISTS tbl_name
ok so what exactly do I do.

Say I have a table jos_products and I want to fill it with the old information do I write an SQL query and what exactly do I write?
At the beginning of the your exported file, write

DROP TABLE IF EXISTS jos_products

this way it will drop your existing table and recreate with the new one along with the data.
and then do i import this file into my new database?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should back up the database before you do anything, just in case you mess up, so you can get everything back.
Hey Storm,
Before I do all of this I read this post
http://www.nultz.com/virtuemart-migration-from-1-0-to-1-1.html
I thought you had to upgrade to vm 1.1 to use the migrator?
Hi again Storm.
I can't seem to get a smooth run of imported my vm tables.

I did my products and categories succesfully but most of the other tables I got errors.

Which tables do you usually export across?

Its difficult to know when exporting tables to a ne version that hat you are dooing is right. I say this because very often the new tables may have new or old columns in the table. Resulting in errors such as "unknown column jos_products_old" for example

I always use navicat and export the data I want without interfering ith the table itself

Regards
sorry my W key is faulty :)
Thanks for this.
I ended up using the mtwMigrator in a fresh install of Joomla 1.5 and V 1.1.4

Seems to all be working nicely now!
Thanks