Forum Moderators: coopster

Message Too Old, No Replies

executing a dump.sql file with php

         

ninjured

8:14 am on Jun 3, 2004 (gmt 0)



hi guys,
Is there an easy way to execute a mysql dump located in the same directory as the php file on unix?

RonPK

9:09 am on Jun 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there ninjured, welcome to WebmasterWorld!

You can run shell commands from a PHP script with commands like exec() and system(). Check the manual to find out which one is right for you.

I'm not 100% sure of the syntax, but something like this might work:
<?php
exec("mysql -u [username] -p[password] -D [database] < dump.sql");
?>