Jump to content

Mysqlimport and LOAD DATA FILE


ClyssaN

Recommended Posts

Hello,

 

Heres my situation:

 

I have a php script that executes the exec command to make a mysqldump of a given database to a file:

 

mysqldump -uroot -p12345 --add-drop-table -Q mydatabase --result-file=dumpfile.sql

 

To restore the database i use:

 

mysql -uroot -p12345 mydatabase < dumpfile.sql

 

This works very well because i want to make a full backup from my webpage and then restore it if necessary.

 

Now the problem is this, i had to move my site to a new server, and the new server runs php in safe mode, so i'm able to run the mysqldump but i'm not able to run the mysql < dumpfile because the "<" is not permited... dont know why...

 

Is there a way to use the LOAD DATA INFILE to import the file generated by mysqldump? The dumpfile.sql deletes and creates the tables

 

I tried the LOAD DATA INFILE but with no success, i have no experience with this command.

 

 

So to resume, is it possible to import a full database with the LOAD DATA FILE command from a mysqldump file, all done via webpage?

 

Thank in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/47582-mysqlimport-and-load-data-file/
Share on other sites

Now the problem is this, i had to move my site to a new server, and the new server runs php in safe mode, so i'm able to run the mysqldump but i'm not able to run the mysql < dumpfile because the "<" is not permited... dont know why...

I thought `<` is a linux piping command, nothing to do with php - contact your server admin.

Now the problem is this, i had to move my site to a new server, and the new server runs php in safe mode, so i'm able to run the mysqldump but i'm not able to run the mysql < dumpfile because the "<" is not permited... dont know why...

I thought `<` is a linux piping command, nothing to do with php - contact your server admin.

 

Yes, you right, it's a linux thing, but i'm not allowed to use the mysql -u -p database < dumpfile (dont know why ...), so i ask if there is a away to use the LOAD DATA with the same affect (using the dumpfile generated by mysqldump).

 

Until now i cannot find a way...

 

Any help you be very appreciated

 

Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.