I need to be able to make changes to my development DB, Such as adding a table or so adding a column.
Is it possible to take this new DB schema and merge it or diff-&-merge it with the production DB without having to rebuild/repopulate the production database?
any tips welcome.
To copy a MySQL database from a server to another, you use the following steps: Export the database on the source server to a SQL dump file. Copy the SQL dump file to the destination server. Import the SQL dump file to the destination server.
In cases where you need to transfer databases between different architectures, you can use mysqldump to create a file containing SQL statements. You can then transfer the file to the other machine and feed it as input to the mysql client. Use mysqldump --help to see what options are available.
The short answer: Yes it is safe for production use and nearly everyone uses the community version.
A simple way to do this is to keep track of your ALTER's and CREATE's in a file.
For example, if I were to add a column to a table on the development db, I would copy paste the sql I used into a file called migrate.sql
. I would keep doing this until I'm ready to migrate to production.
At this point the file would be a series of sql statements that could be run in order on the production db to "sync" it with the development environment.
If you're not writing the raw queries yourself, you can probably get the commands being run out of whatever GUI tool you're using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With