Can MySQL databases be copied between websites?

I’m still a novice at PHP and have only nibbled at MySQL, which I find very intimidating. It just occurred to me that the greatest learning tool would be an actual working model that I could study and manipulate. It would save me from asking a zillion questions over the next few weeks.

So, is it possible to copy a simple MySQL database and one or two pages driven by that database to another website. In other words, if I found a willing donor, could I find a data-base driven page on my website fifteen minutes later that I could download and modify?

If it’s impossible, then I might ask if anyone would be willing to help me visualize a simple database system and post the code for it. For example, let’s say I have a website that focuses on the six continents, the three major North American nations and four states (Alabama through Arkansas).

And let’s say I have a database that features each jurisdiction’s name, abbreviation, capital and linking code - like world/na/us/ak for North America > U.S. > Alaska.

What would the source code of a page driven by that website look like?


Install phpmyadmin… best way to manage your mysql database fast and effective.

you could then merely write a cron script (if unix/linux) to copy the var folder from mysql and ftp or shuttle it to your other server. or write a script that exports everything, moves it to other box, and then drop all other tables and reinsert the updated version… anyone else know of a better way?

Actually, I already have phpMyAdmin installed. I was having problems with it, so I downloaded some other MySQL manager, but the free trial period has expired, so I guess I’d better fix phpMyAdmin!


I don’t quite understand what you are trying to do here.

Use a remote database? Make sure your username on that database has the rights to connect remotely. If using MySQL 4 serie on both servers, you might want to give replication a try.

Copy a database? Use mysqldump (Export feature in phpMyAdmin) and un the output in your local mysql client.

Grab data from an other website? There are many options: cURL, Snoopy, Tidy (can help parsing).

Something else? Start from the begining and explain.


this excellent MySQL manager does it excellently, i think is the address

the new v3.0 sucks in my opinion, so i would suggest using v2.5

here is the download for v2.5

The most simple way is to dump the database (using mysqldump) and run the script in the other database.


mysqldump -u your_user -p database_name > target_file


mysql -u your_user -p database_name < target_file

This can also be done from phpMyAdmin using Export and SQL query (with file).

Sponsor our Newsletter | Privacy Policy | Terms of Service