Page 1 of 1
How copy a mysql database to another server
Posted: Sun Jun 06, 2010 5:31 pm
by Rksk
howto copy a mysql db to another db on another server with all data using php ?
Re: How copy a mysql database to another server
Posted: Mon Jun 07, 2010 12:58 am
by Neo
There are many options for this.
- You can have two connections to both databases and iterate through all tables and copy records.
Here you can either copy each record using a loop or use something similar as below.
mysql_query("SELECT * INTO OUTFILE 'temp.sql' FROM my_table", $conn1);
mysql_query("LOAD DATA INFILE 'temp.sql' INTO TABLE my_table", $conn2);
- If you have phpMyAdmin, you can use Export from source and and use Import at destination end.
- You can easily use mysqldump to backup your database to a file and then restore it using command "mysql" at destination end.
Last two methods are usually used. However you can use first one if you have an interest to learn php.
Re: How copy a mysql database to another server
Posted: Mon Jun 07, 2010 4:59 pm
by Rksk
i want to backup my db daily with freemysql.net
can you give an eample in php?
thankz
Re: How copy a mysql database to another server
Posted: Mon Jun 07, 2010 10:02 pm
by Saman
See tutorials in that website. All required information are there. If you can't find anything, just ask them. ROBOT.LK can't support on 3rd party products.
Regards...
Re: How copy a mysql database to another server
Posted: Mon Jun 07, 2010 11:51 pm
by Rksk
Thankz.
freemysql.net is only a mysql server.
Re: How copy a mysql database to another server
Posted: Tue Jun 08, 2010 12:20 am
by Neo
Saman wrote:See tutorials in that website. All required information are there. If you can't find anything, just ask them. ROBOT.LK can't support on 3rd party products.
Regards...
I agree. It's all well explained there. Read through
http://www.freemysql.net/v2/tutorials/p ... part-1.php.
Re: How copy a mysql database to another server
Posted: Tue Jun 08, 2010 6:09 am
by Rksk
Saman & Neo wrote:ROBOT.LK can't support on 3rd party products.
Both of you have forgot one thing.
if you don't support on 3rd party producs, you will can't help us to use any software , ect.
don't care, a joke only.
thankz.
Re: How copy a mysql database to another server
Posted: Tue Jun 08, 2010 10:16 am
by Saman
Both of you have forgot one thing.
if you don't support on 3rd party producs, you will can't help us to use any software , ect.
3rd Party products means the products that are made using other products. Usually our topics are made for the original products.
For example the product you have added which was build on MySQL. Our topic is MySQL/SQL and Database concepts.
It is usual to have a complete help on site for such products/packages. It is unlikely that you get help for these kind of products from ROBOT.LK as no one is willing to install those on their machines.
