0

I need to be able of sync my webserver databases , matching them with my localhost database, but just the structure, not the records.

Per example if I add one new table to my localhost db, I run the script and it applyes to the server db populating it with default values.

How can I do that?

replication in not what I need, since it is automatic and I don't want that. I think the phpmyadmin synchronization would be good, but it also sync records.

1 Answer 1

1

Use MySQL dump with --no-data switch. http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-data

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for reply, well so many options over there :-) I'm trying but can't find a way of making it happen, always get a 127 using this if(system("mysqldump -v --no-data -h localhost -u USER - pPASS test | mysql -h localhost -u USER -pPASS test_dump 2>&1", $system_result)) { echo $system_result; }
Instead of running that in PHP, create a shell script that works and execute it from PHP (if you must). Much cleaner and less error prone approach.
Sorry for late reply, I don't know how to make that shell script, need to study that. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.