简体   繁体   English

mysqldump 不产生任何输出

[英]mysqldump not producing any output

I need to dump the entire database to a text file, but mysqldump is not outputting anything.我需要将整个数据库转储到一个文本文件,但 mysqldump 没有输出任何内容。 Here is the command i'm executing via php script:这是我通过 php 脚本执行的命令:

<?php
  $_user="root";
  $_pass="";
  $_db="somedb";
  $_host = "localhost";

  $filename = "somedb.zip";
  $target_fn = "test.txt";

  $command = 'c:\xampp\mysql\bin\mysqldump -u'.$_user.' -p'.$_pass.' -  
              h'.$_host." ".$_db.' > test.txt';
   try{
     exec( $command );
   } 
   catch(Exception $e){
     echo $e;
   }
?>

EDIT编辑

I"m on a XAMPP stack.我在 XAMPP 堆栈上。

EDIT After running the above command on a cmd, i realized it still prompts for a password.编辑在 cmd 上运行上述命令后,我意识到它仍然提示输入密码。 Perhaps an empty password is what the command is misinterpreting wrongly.也许空密码是命令错误解释的原因。

So the problem was the command syntax/structure for a blank password. 因此,问题在于空白密码的命令语法/结构。 Here is the correct command for a blank pass: 这是空白通行证的正确命令:

$command = 'C:\xampp\mysql\bin\mysqldump -u'.$_user.' -h'.$_host." ".$_db.' > test.txt';
$return_var = NULL;
$output = NULL;
$command = "/usr/bin/mysqldump -u mysql-user -h 123.145.167.189 -pmysql-pass database_name > /path-to-export/file.sql";
exec($command, $output, $return_var);

Try giving 2 more parameters to the exec尝试给 exec 再提供 2 个参数

Reference参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM