简体   繁体   English

PHP mysqldump不返回任何数据

[英]PHP mysqldump returns no data

I have this script: 我有这个脚本:

$command = "mysqldump --opt -h".DB_SERVER." -u".DB_USER." -p".DB_PASS." ".DB_NAME." | gzip > ".$filename;
system($command,$output);
echo $output;

It looks ok and it returns 0. 它看起来没问题,它返回0。

The file its producing contains: 其生成的文件包含:

-- MySQL dump 10.13  Distrib 5.1.73, for pc-linux-gnu (i686)
--
-- Host: localhost    Database: database_gourmet
-- ------------------------------------------------------
-- Server version   5.1.73-cll

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

No tables no data, what gives? 没有表没有数据,是什么给出的?

Using PuTTY and echoing as Marc B suggested I found the problem, it was responded in this post: 使用PuTTY并回显为Marc B建议我发现了问题,它在这篇文章中得到了回复:

https://dba.stackexchange.com/questions/84370/why-mysqldump-is-returning-with-error-1143-couldnt-execute-show-table-status https://dba.stackexchange.com/questions/84370/why-mysqldump-is-returning-with-error-1143-couldnt-execute-show-table-status

I resolved forcing the output -f: 我决定强制输出-f:

$command = "mysqldump -f -h".DB_SERVER." -u".DB_USER." -p".DB_PASS." ".DB_NAME." | gzip > ".$filename;

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

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