List:General Discussion« Previous MessageNext Message »
From:Ananda Kumar Date:June 15 2012 6:58pm
Subject:Re: mysqldump not escaping single quotes in field data
View as plain text  
I have mysql 5.5.
I am able to use mysqldump to export data with quotes and the dump had
escape character as seen below

LOCK TABLES `ananda` WRITE;
/*!40000 ALTER TABLE `ananda` DISABLE KEYS */;
INSERT INTO `ananda` VALUES
(1,'ananda'),(2,'aditi'),(3,'thims'),(2,'aditi'),(3,'thims'),(2,'aditi'),(3,'thims'),(2,'aditi'),(3,'thims'),(2,'aditi'),(3,'thims'),(5,'O\'Brien');
/*!40000 ALTER TABLE `ananda` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;


Import it back to database

Database changed
mysql> drop table ananda;
Query OK, 0 rows affected (0.00 sec)

mysql --database test < test.dmp

mysql> select * from ananda;
+------+---------+
| id   | name    |
+------+---------+
|    1 | ananda  |
|    2 | aditi   |
|    3 | thims   |
|    2 | aditi   |
|    3 | thims   |
|    2 | aditi   |
|    3 | thims   |
|    2 | aditi   |
|    3 | thims   |
|    2 | aditi   |
|    3 | thims   |
|    5 | O'Brien |
+------+---------+

May be u want to upgrade you database

On Fri, Jun 15, 2012 at 10:48 PM, James W. McNeely
<jim@stripped>wrote:

> My backups from a mysqldump process are useless, because the dump files
> are not escaping single quotes in the data in the fields.
>
> So, O'Brien kills it - instead of spitting out
> 'O\'Brien'
> it spits out
> 'O'Brien'
>
> I don't see anywhere in the documentation about mysqldump where you can
> tweak this kind of thing.
>
> We're using MySQL 5.0.70 enterprise on Ubuntu 8.04.1.
>
> I tried to enter this into the Oracle support center but all of the
> navigational and SR tabs are gone. Maybe our accounting dept. forgot to pay
> the bill or something.
>
> Thanks,
>
> Jim McNeely
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>
>

Thread
mysqldump not escaping single quotes in field dataJames W. McNeely15 Jun
  • Re: mysqldump not escaping single quotes in field dataAnanda Kumar15 Jun
  • RE: mysqldump not escaping single quotes in field dataRick James15 Jun
    • Re: mysqldump not escaping single quotes in field dataAnanda Kumar16 Jun