
02-10-2011, 05:31 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Feb 2011
Posts: 76
|
|
Mysqldump problem via SSH.
Hello, I have problem with mysqldump via SSH, I made backups using
Code:
mysqldump --add-drop-table -u dbusername -p dbname > backup.sql
// and
mysqldump --opt -u dbusername -p dbname > backup.sql
// and
mysqldump -u dbusername -p dbname > backup.sql
and always in my backups I can see a lot of unnecessary text like a ---- Dumping data for table `dle_banned`--, and other.
Please tell me what kind of commands I should use to make CLEAR copy of database without unnecessary text?
Thanks for help.
|

02-10-2011, 06:08 AM
|
|
Community Liaison 2.0
|
|
Join Date: Feb 2005
Location: Australia
Posts: 5,112
|
|
You can use the option --skip-comments to suppress these, but in practice the size difference will be minimal on a typical database.
__________________
Chris
"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx
|

02-10-2011, 06:15 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Feb 2011
Posts: 76
|
|
Hmm, but not only comments are there, do you know command that do not add nothing ? I just want to have clear backup.
|

02-10-2011, 07:42 AM
|
|
Community Liaison 2.0
|
|
Join Date: Feb 2005
Location: Australia
Posts: 5,112
|
|
Pretty much anything that isn't a comment is database structure or data - without it you won't have a backup at all. What exactly do you want to do with this "clear backup"?
__________________
Chris
"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx
|

02-10-2011, 07:50 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Feb 2011
Posts: 76
|
|
Take a look I always make backups by my cms , but now I can't so I using mysqldump and it add to my dbbackup garbage like a :
1.)-- Dumping data for table 'xxx'
2.)-- Table structure for table `dle_banners`
3.)
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
and more important changing fragment from cms-backup
INSERT INTO `dle_banned` VALUES
(11, 8172, 'Reklama', '0', 0, ''),
(15, 14561, 'Ban for spam', '0', 0, ''),
itd
to this:
INSERT INTO `dle_banned` VALUES (11,8172,'Reklama','0',0,'');
INSERT INTO `dle_banned` VALUES (15,14561,'Ban for spam','0',0,'');
INSERT INTO `dle_banned` VALUES (22,15143,'Ban for: multi-account ','0',0,'');
So do you know any way to make backup without changes ?
|

02-10-2011, 07:59 AM
|
|
Community Liaison 2.0
|
|
Join Date: Feb 2005
Location: Australia
Posts: 5,112
|
|
1. and 2. are comments - they should disappear with --skip-comments. For the rest, character sets and table structure are important - with incorrect character set you'll get garbled text and without table structure you'll have nothing to insert data into.
Again, why does this matter to you?
__________________
Chris
"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx
|

02-10-2011, 08:29 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Feb 2011
Posts: 76
|
|
I just worry abut mysql speed and working with unnecessary text.
I know, maybe I am worrying to much about deatail but my copy from cms looks better the it ;]
|

02-10-2011, 09:23 AM
|
|
Web Hosting Master
|
|
Join Date: Nov 2006
Location: Karachi, Pakistan
Posts: 1,118
|
|
You want a smaller backup then try this command:
mysqldump -p password -u username -ce --skip-comments dbname > dbbackup.sql
Also if you skip 'password' it will prompt you for one. This prevents the password from being saved in your bash history (i.e. it is more secure):
mysqldump -p -u username -ce --skip-comments dbname > dbbackup.sql
Last edited by Website themes; 02-10-2011 at 09:31 AM.
|

02-10-2011, 09:30 AM
|
|
Quant Trader
|
|
Join Date: May 2001
Location: HK
Posts: 2,931
|
|
Quote:
Originally Posted by Mondo90
and more important changing fragment from cms-backup
INSERT INTO `dle_banned` VALUES
(11, 8172, 'Reklama', '0', 0, ''),
(15, 14561, 'Ban for spam', '0', 0, ''),
itd
to this:
INSERT INTO `dle_banned` VALUES (11,8172,'Reklama','0',0,'');
INSERT INTO `dle_banned` VALUES (15,14561,'Ban for spam','0',0,'');
INSERT INTO `dle_banned` VALUES (22,15143,'Ban for: multi-account ','0',0,'');
|
This is a lot slower, the first one is optimized.
|

02-10-2011, 10:02 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Feb 2011
Posts: 76
|
|
Hmmm, can I use multi options for example, --skip-opt and --compact
?
|

02-11-2011, 11:57 AM
|
|
Web Hosting Master
|
|
Join Date: Nov 2006
Location: Karachi, Pakistan
Posts: 1,118
|
|
Quote:
Originally Posted by Mondo90
Hmmm, can I use multi options for example, --skip-opt and --compact
?
|
Yes see my post above. -c is the same as --compact.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|