[wp-hackers] Using Live Database with Development environment

Andrew Spratley aspratley at gmail.com
Fri Mar 2 10:18:29 UTC 2012


Personally I wouldn't feel comfortable running dev code against a live
DB directly.

The way I'm thinking of automating it, is to take my nightly backups
and then restore them to a dev/staging database and run a variation of
http://interconnectit.com/124/search-and-replace-for-wordpress-databases/
to handle the domain renames for the dev URL.

I use a switch statement around the DB config settings to pick the
correct DB depending on the HTTP_HOST variable.

The simple flow would be:
DUMP (backup) live DB
DROP existing dev DB
RESTORE backup DB to dev DB
search and replace domain name on dev DB

For most of my purposes a nightly view of the DB is more than enough
for development.



On Fri, Mar 2, 2012 at 11:44 AM, Baki Goxhaj <banago at gmail.com> wrote:
> This is a situation that many WP developers are coming across more and more
> due to the fact that version control systems are being used very much, as
> they should - they are a blessing. Now, when you need to test with the
> actual site, just making a local copy of the live database won't always
> work, especially on fast-chaining sites.
>
> That bash script seemed promising  - looking into it more in-depth.
>
> However, if somebody else has a personal approach to this, that would be
> great if they share it with us.
>
> Kindly,
>
> Baki Goxhaj
> www.wplancer.com | proverbhunter.com | www.banago.info<http://proverbhunter.com>
>
>
> On Fri, Mar 2, 2012 at 2:37 AM, Daniel Fenn <danielx386 at gmail.com> wrote:
>
>> That question is a little off topic but I can give some direction to
>> help you out (note that I have not done this myself) In the mysql
>> userguide (5.5 I'm talking about) There a whole chapter on setting up
>> replication.
>>
>>
>> The best idea is to just make a backup of the wordpress database, do
>> your testing on your test server then just make the changes on the
>> live server.
>>
>> Regards,
>> Daniel Fenn
>>
>>
>>
>>
>>
>>
>>
>> On Fri, Mar 2, 2012 at 12:31 PM, Chris Williams <chris at clwill.com> wrote:
>> > I have a similar problem and was thinking of this exact solution.  Can
>> you
>> > provide any details on how to do that?  I'm not familiar with how to do
>> > that in MySQL.
>> >
>> > Thanks!
>> >
>> > On 3/1/12 4:20 PM, "Daniel Grundel" <daniel at webpresencepartners.com>
>> wrote:
>> >
>> >>Connecting a development site to my production database would make me a
>> >>little nervous. I'd be concerned that a plugin or something else on my
>> dev
>> >>site would bork up my production database.
>> >>
>> >>Have you considered setting up one way replication from your production
>> db
>> >>to a second development db? That would keep the dev site up to date
>> >>without
>> >>possibly compromising your production data.
>> >>
>> >>Daniel J. Grundel
>> >>Web Presence Partners
>> >>webpresencepartners.com
>> >>772 678 0697
>> >>On Mar 1, 2012 7:12 PM, "Dmitry Tokmakov" <dmitry at getmoxied.net> wrote:
>> >>
>> >>> Hello!
>> >>>
>> >>> I have the following situation which I am trying to resolve and am
>> >>>looking
>> >>> for some assistance with a strategy to do so.
>> >>>
>> >>> I have:
>> >>>
>> >>> 1. A production WordPress site that is being edited very frequently.
>> >>>
>> >>> 2. A development WordPress site that needs to make use of the
>> production
>> >>> sites database.
>> >>>
>> >>> I would like to setup the development server to make use of the same db
>> >>>so
>> >>> when edits are made to the prod or dev enviroment all data is in sync.
>> >>>
>> >>> Does anyone have any other experience with this type of situation or
>> >>>maybe
>> >>> can recommend a strategy to go about doing this?
>> >>>
>> >>> Thank you in advance,
>> >>>
>> >>> Dmitry Tokmakov
>> >>> Digital Spin
>> >>>
>> >>> _______________________________________________
>> >>> wp-hackers mailing list
>> >>> wp-hackers at lists.automattic.com
>> >>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >>>
>> >>_______________________________________________
>> >>wp-hackers mailing list
>> >>wp-hackers at lists.automattic.com
>> >>http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hackers at lists.automattic.com
>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list