|
Posted by damezumari on 06/20/07 18:22
I use Windows XP and Apache.
I am trying to backup a database on my local computer with the
following php code:
$dbname = 'ol';
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$backupFile = $dbname .'-' .date("Y-m-d-H-i-s") . '.sql';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname >
$backupFile";
if (!system($command, $retval)){die('Backup failed.);}
It does produce a file like C:\Program Files\xampp\htdocs
\onlinelearning\ol-2007-06-20-13-31-09.sql, but it is empty.
mysqldump.exe is at C:\Program Files\xampp\mysql\bin\mysqldump.exe and
the script is sitting in the folder C:\Program Files\xampp\htdocs
\onlinelearning.
When I put a copy of mysqldump.exe in the folder C:\Program Files\xampp
\htdocs\onlinelearning I get a black sreen saying 'Enter password:'.
When I give the password I get a file like this:
-- MySQL dump 10.10
--
-- Host: localhost Database: ol
-- ------------------------------------------------------
-- Server version 5.0.18
/*!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 */;
---
Any help is greatly appreciated.
Regards,
Jan Nordgreen
[Back to original message]
|