Solved

Moving Data in PHP MySQL from one table with records to the same named table with no records

Posted on 2013-06-06
8
293 Views
Last Modified: 2013-06-10
I have a database i have installed with a product open source Bug Ticketing system called Mantis. I installed Mantis on a new website with a new ISP. (no Records in this DB) The old ISP had the same version of Mantis with just a few records in it I wanted to move those records....that data to the new site. Is this possible if so how do I do that. Please advise thank you.
0
Comment
Question by:ruavol2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 31

Assisted Solution

by:Frosty555
Frosty555 earned 167 total points
ID: 39227141
If this is a one-time thing, the easiest way to do it is to mysqldump the contents of the old table, manually edit the .SQL dump file to have the new database/table name, and then execute the dump query against your MySQL server.

If you have PHPMyAdmin installed, you can use the Export/Import options to do this, otherwise you can use the mysqldump command line utility on your server

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
0
 

Author Comment

by:ruavol2
ID: 39227180
I have already imported the tables they are in the DB twice. In fact they have a weird icon and the column under the PHP MyAdmin Table list on the far left. See image attached.
So the tables are in there twice. One empty and one with records. Is there a simply way to say put these records in that table with the same name......? Like Mantis_Users    to   Mantis_Users

Note the highlighted area in yellow and the Mantis (31) representing the tables I imported with records the Mantis Tables at the higher level are the tables I installed to for the website and are empty........? Does that help
PHPMyAdmin-Mantis.png
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 39227244
Hmm... Some of the tables seem to have a single underscore in the name and others seem to have a double underscore.  Am I seeing that correctly?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 57

Expert Comment

by:Julian Hansen
ID: 39227330
0
 

Author Comment

by:ruavol2
ID: 39227444
julianH Yes I do but that seem to not be answered about a data merge but a table merge. This question asks only about merging the data.

Ray_Paseur Yes there seems to be a double underscore there. Yes and I see why the double underscore seems to signify where the imported tables are They seem to follow the Mantis (31)  tables that are there and flow to the bottom of the 31 list.
0
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 167 total points
ID: 39227528
I think Ray has spotted the problem. Just checked the data you posted in my db and the tables have double underscores.

What is the correct name for the tables - with or without double underscores?

You could probably do a search and replace on the sql file you posted - but I had to kill my text editor while editing that file - it choked after I got 1500 or so lines down. Might be easier to just delete the tables that are there and rename the new ones.

With regard to merging - at the data level you will need a script - PHPMyAdmin just runs SQL queries and the ones in the export dump are create and insert statements - so they will overwrite / add to what you have but won't merge - but from what I gather the other tables are throw away anyway?
0
 

Author Closing Comment

by:ruavol2
ID: 39236480
Thanks to you guys I figured it out. It would seem all I had to do was to delete or drop the empty tables in PHPMyAdmin and then go in and rename the tables by removing the "extra underscore" created apparently by the import. The import put a Mantis__??? infront of the imported tables. It seems to have worked by simply removing the one underscore. Thanks for your help gentlemen....
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39236515
Glad you got it pointed in the right direction!  Best regards, ~Ray
0

Featured Post

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question