Reputation: 5619
I have a question regarding how to set up local and production versions of a WordPress website that uses, PHP an MySQL.
I want to have these two versions (local and production) use different databases because we can test.
I will be using git to push my changes up to the server.
I have MySQL installed locally, and a webserver set up locally, but I don't know of a way to push mysql changes to the server and keep it connected with with git.
I will be working with several others so it needs to be using git for the database.
How would I go about doing this?
Thank you for any help!
Upvotes: 1
Views: 204
Reputation: 4467
You can dump the scheme and/or the data to a file and then check that file into git.
For example, this will dump the table schema and data to a file named [table_name].sql
mysqldump --user=[user_name] -p --opt [local_database_name] [table_name] > [table_name].sql
To load this data in production, you would do something like this:
mysql --user=[user_name] -p [server_database_name] < [table_name].sql
Upvotes: 1