Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have an error when I try to restore a dumped file from the same server and version of MySQL.

I used this to produce the dump:

exec('mysqldump --user=... --password=.. --host=localhost data_base > '.$cale.')';

This is the error I get:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COL' at line 8

And the first few lines of the dump file are:

2.  -- MySQL dump 10.13  Distrib 5.1.70, for unknown-linux-gnu (x86_64)
3.  --
4.  -- Host: localhost    Database: sfantatr_caserie
5.  ---------------------------------------------------------------
6.  -- Server version   5.1.70-cll
7. 
8.  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
9.  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
10. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
11. /*!40101 SET NAMES utf8 */;
12. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
13. /*!40103 SET TIME_ZONE='+00:00' */;
14. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
15. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
16. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
17. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

Please tell me what is wrong, and what I can do to correct this problem.

share|improve this question
2  
How are you trying to restore this dump? –  altmannmarcelo Aug 29 '13 at 10:16
    
i try to restore via php. Here is the code: 1. $fh = fopen($myFile, 'r'); 2. $theData = fread($fh, filesize($myFile)); 3. fclose($fh); 4. if (!mysql_query($theData)) $err='EROR !!!mysql_err='.mysql_error(); <- is there anyting wrong ?? -> –  Romeo Ilie Blanaru Sep 5 '13 at 5:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.