Can MySQL databases be copied between websites?


#1

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?

Thanks.


#2

Install phpmyadmin… best way to manage your mysql database fast and effective. http://www.phpmyadmin.net/home_page/

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?


#3

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!

Thanks.


#4

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.


#5

YES, THEY CAN!

this excellent MySQL manager does it excellently,

http://mysql-front.de 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 http://mysqlfront.phpsoft.it/MySQL-Front_2.5_Setup.exe


#6

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

Export:

mysqldump -u your_user -p database_name > target_file

Import:

mysql -u your_user -p database_name < target_file

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