ChrisMacPherson
Programmer
Hi All,
I have been using mysqldump for a while now, but have just come across a problem.
I am using the mysqldump program from PHP to dump the database into a file. This works fine.
I then try to feed that sql from the file back into mysql to recreate the database, like a backup procedure. This produces an error.
When I look at the dumped database file it looks like this which I have never seen before:
I only show the top as it is the code at the top that is causing the error:
I ahve been trying to work out how to get rid of the stange lines at the top of the dumped file (i.e '/*!40101') but cant work out how.
I know these lines are for compatibility with other mysql versions.
This is all part of an automatic script to alter a database so I would not just be able to edit the sql file manually to remove these error causing lines.
Any help would be appreciated, cant find much help elsewhere!
Chris MacPherson
I have been using mysqldump for a while now, but have just come across a problem.
I am using the mysqldump program from PHP to dump the database into a file. This works fine.
I then try to feed that sql from the file back into mysql to recreate the database, like a backup procedure. This produces an error.
When I look at the dumped database file it looks like this which I have never seen before:
Code:
/*!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 */;
DROP TABLE IF EXISTS `chc_areainfo`;
CREATE TABLE `example_table` (
`foo` varchar(25) NOT NULL default '',
`bar` text NOT NULL,
.........
Code:
MySQL Error : 1064 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 '; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101' at line 7
I ahve been trying to work out how to get rid of the stange lines at the top of the dumped file (i.e '/*!40101') but cant work out how.
I know these lines are for compatibility with other mysql versions.
This is all part of an automatic script to alter a database so I would not just be able to edit the sql file manually to remove these error causing lines.
Any help would be appreciated, cant find much help elsewhere!
Chris MacPherson