Page 1 of 1

mysql bulk update table structures

Posted: Tue Jun 01, 2010 1:11 pm
by JakeJ
I'm having a surprisingly hard time finding the answer to this question but how do I do bulk updates of table structures.

I know how to use the alter command, but I need to know how to export my local table structure and import it in to my server without touching the data. I'm not seeing any way to do this with phpmyadmin. It will just create a table if it doesn't exist, but it won't add my extra fields.

Thanks

Re: mysql bulk update table structures

Posted: Wed Jun 02, 2010 7:26 am
by jaiswarvipin
yes PHPMYSQL fdoes have feature only that are devided in tow step.

1) you have do on the database ans say "Export" and then it will ask you select that table and with data. So uncheck that option. and say go. IT will give you you all table create statement in that. Simply copy or save iun other file.
2) Now on destination table siply import the generated data and say go.

Done :)

Re: mysql bulk update table structures

Posted: Wed Jun 02, 2010 12:22 pm
by JakeJ
jaiswarvipin,

That doesn't work if the table already exists. It doesn't alter an existing table.

I think what I really need is a tool that can compare two database structures and build a series of ALTER statement from there.

Re: mysql bulk update table structures

Posted: Wed Jun 02, 2010 12:35 pm
by mikosiko
JakeJ wrote: build a series of ALTER statement
there you go!!... but be careful if you changed your table structure drastically, because in that case you can face some problems.... if you only added fields you should be ok (attention with the NOT NULL's or referential integrity rules if you added some)

Re: mysql bulk update table structures

Posted: Wed Jun 02, 2010 1:40 pm
by JakeJ
Back to the original question. I want to do do bulk structural changes. I know how to use the ALTER statement already. What I need is a tool that will look at the structure of two databases and then create a series of ALTER statements so I can make database2 just like database1 without affecting the data inside.

Re: mysql bulk update table structures

Posted: Wed Jun 02, 2010 7:02 pm
by mikosiko
never tried it myself... but maybe it could work for you

http://www.webyog.com/images/screenshot ... a_sync.png

and I do understand that MYSQL Workbench also have the database sync functionality
http://wb.mysql.com/?page_id=11