0

Hi

Does anyone know what is the simplest way to backup a database using the mysqldump function in php?


I have googled a lot and the codes i have found are very hard to understand and most of them does not work.

Thanx in advance for your help.

5
Contributors
8
Replies
9
Views
10 Years
Discussion Span
Last Post by MitkOK
0

If you are allowed to use exec() then that will make it a one line script. Otherwise you can't access mysqldump directly through PHP.

0

If you are allowed to use exec() then that will make it a one line script. Otherwise you can't access mysqldump directly through PHP.

... or system() :cool:

0

Backup :

$command = "mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]";

Restore :

$command = "mysqldump -u [username] -p [password] [databasename] < [backupfile.sql]";
system($commmand);

- Mitko Kostov

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.