Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 209889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:57:22+00:00 2026-05-11T17:57:22+00:00

I need to frequently duplicate one database on my MySQL server to a mirror

  • 0

I need to frequently duplicate one database on my MySQL server to a mirror database on the same MySQL server.

I am writing a bash script that makes a mirror of my web application (PHP/MySQL) on a separate subdomain. Users can use this mirror to try out all kinds of crazy things without affecting the production environment. The script is supposed to run automatically every night.

Duplicating the source code is easy. I just use rsync -a to copy everything from the directory holding the production environment to the mirror directory and apply a patch to update a few configuration files. The problem is with duplicating the database, which has grown to nearly 3 GB in size.

When I use mysqldump live_db | mysql mirror_db then it takes forever to duplicate the database. Also, during that time CPU usage peaks to 100% and my web application becomes unusably slow.

Database replication does not seem to be an option since I only have one MySQL server. Replication requires two servers.

What is the best way to duplicate the production database? It doesn’t have to be fast, but it should not impact performance of the system too much. People should still be able to use my web application while the mirror script is running in the background.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:57:22+00:00Added an answer on May 11, 2026 at 5:57 pm

    Possible solutions I can think of:

    1) Buy a faster server

    2) Copy the raw tables. This isn’t ideal but if it’s just for testing could be viable.

    I’m going to assume you’re using MyISAM tables but here are the steps:

    • Ideally write lock the tables in the production database, ignore if this is not possible
    • Copy the binary table data/indexes from /var/lib/mysql/production_schema (or similar) to /var/lib/mysql/development_schema. rsync -a (run as root) would be idea for doing this with.
    • restart the MySQL server (this is your only downtime in the whole process)
    • CHECK/REPAIR all of the tabes in development_schema

    It’s worth adding that I wouldn’t use this method as a way of copying data from one production environment to another without stopping the server before making the copy.

    3) consider whether you need all of the production data in the development environment. Could you be smart and only copy a subset of the data?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some code that needs to frequently append to the end of a
In data processing, I frequently need to create a lookup data structure to map
I have a few batch files I need to run frequently in developing a
I'm working with a code base where lists need to be frequently searched for
I need to calculate Math.exp() from java very frequently, is it possible to get
The situation When you study social sciences, you are frequently confronted with the need
When installing one of JRuby's frequent upgrades, I need to re-install my gems, as
Need a function that takes a character as a parameter and returns true if
Need to an expression that returns only things with an I followed by either
I currently have a single solution that contains both the one application developed so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.