I am trying to write a PHP program to automatically created backups of MySQL tables as sql files on the server:
$backup = "$path/$tablename.sql"; $table = "mydbname.mytablename"; exec( sprintf( '/usr/bin/mysqldump --host=%s --user=%s --password=%s %s --quick --lock-tables --add-drop-table > %s', $host, $user, $password, $table, $backup ) );
All that I get in the resulting .sql file is this:
-- MySQL dump 10.10 -- -- Host: localhost Database: mydbname.mytablename -- ------------------------------------------------------ -- Server version 5.0.27 /*!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 */;
It seems fishy that the results list Database:mydbname.mytablename.
I don't know where to start looking. My host, in helping my set up the program initially, said I would need to deactivate safe_mode (was already done) and give access to the binary (I don't know what this means).
Since the host takes two days to reply every time I ask a question, I'd like to resolve this myself if possible.