Jump to content

Mysql dump - database backup


esport

Recommended Posts

Hi guys,
Im trying to back my database up by using mysqldump and saving the results in a .sql file. However the file is returned with a few lines of text and not the sql of the tables.
Here is a snipet of the code i am using:

[code]
$LOCAL_DUMP_PATH = "db_back/"; 
$FILENAME_PREFFIX = "sqldump";         

$filename = $FILENAME_PREFFIX.date("YmdHis").".sql";

$dump_cmd = "mysqldump -h'$DB_HOST' -u'$DB_USERNAME' -p'$DB_PASSWORD'";

$dump_cmd .= " --all-databases";

$dump_cmd .= " > $LOCAL_DUMP_PATH$filename";
exec($dump_cmd);
[/code]

Thanks
Daniel
Link to comment
Share on other sites

This is the output i get:

[tt]-- MySQL dump 10.10
--
-- Host: localhost    Database:
-- ------------------------------------------------------
-- Server version 4.1.21

/*!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 */;

--
-- Current Database: `IT2002_actiond`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `IT2002_actiond` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `IT2002_actiond`;[/tt]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.