php - mysqldump doesn't run correctly -


I write some code with PHP in the backup database.

My code here:

  exec ("mysqldump --opt -h localhost - u root test"; mydb.sql ");  

But I get 0-byte in my file (mydb.sql). I also run with system (), system (), but it still gets 0-byte.

I try to use the command. It works.

I use the latest XAMPP for my localhost.

So, how can I work it correctly?

This is probably a permission problem, or the fact that you are not passing passwords to see the errors For, STDOUR to 2 & gt; & Amp; 1

  exec ("mysqldump --opt -h localhost -us root test> mydb.sql 2 & gt; and 1", $ output); Print_r ($ generation);  

This will show you the errors that you will normally see on the command line.


Comments