I'm curious what other people do with respect to the database when writing new code for a site that's already live?

Before a site is live when im working on my local testing server i connect to a local version of my database. Once the site is live though this is not an option as i cant just download a copy of the latest live database and then upload when i am finished working on it as anything in-between on the live database would be lost. If i connect to the live database from my local testing server i cant go into my database and start editing things as it might break the live site. Im sure im missing some obvios method here?