-1

I have a mysql broken database and I have another one which is good and with all tables and columns. How can I import in broken database only missing info which is in good database? I mean tables and columns and values not stored info.

I exported good database and when I try to import in broken database I get: #1060 - Duplicate column name 'id_advice'

So, what I need is to skip if duplicate items and continue to add only info which does not exist.

Ilona
  • 357
  • 3
  • 10
Silviu
  • 33
  • 1
  • 1
  • 7

2 Answers2

1

You can make use of Mysqldump. There is a selection to use no data.

mysqldump -uYourUserName -p=YourPassword databasename --no-data --routines > "dump.sql"

The you can import the table stucture. there is also different options to use create if not exists or drop if exists so you can tailor make it for your needs. I recommend downloading Mysql Workbench, its easily done with that tool.

Info about mysqldump http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
-1

You can use "IF EXIST" in your SQL statement.

You get every record/table/what-you-want with PHP or an other programmation language.

Then, you build some statement like this :

IF NOT EXISTS (SELECT what-you-want FROM BrokenTable WHERE some-test=some-value) INSERT INTO ClearTable(value, that, you, need, to, insert);

Hope I helped you.

Kaijiro
  • 339
  • 1
  • 3
  • 14
  • what I need is to skip if duplicate items and continue, to add only info witch does not exist – Silviu Oct 18 '13 at 19:32