Results 1 to 11 of 11
Thread: Mysqldump problem via SSH.
-
02-10-2011, 05:31 AM #1WHT Addict
- Join Date
- Feb 2011
- Posts
- 115
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
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 #2Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
You can use the option --skip-comments to suppress these, but in practice the size difference will be minimal on a typical database.
Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
02-10-2011, 06:15 AM #3WHT Addict
- Join Date
- Feb 2011
- Posts
- 115
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 #4Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
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
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
02-10-2011, 07:50 AM #5WHT Addict
- Join Date
- Feb 2011
- Posts
- 115
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 #6Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
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
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
02-10-2011, 08:29 AM #7WHT Addict
- Join Date
- Feb 2011
- Posts
- 115
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 #8Web Hosting Master
- Join Date
- Nov 2006
- Location
- Karachi, Pakistan
- Posts
- 1,359
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.sqlLast edited by /dev/random; 02-10-2011 at 09:31 AM.
-
02-10-2011, 09:30 AM #9Web Hosting Master
- Join Date
- May 2001
- Location
- HK
- Posts
- 3,082
-
02-10-2011, 10:02 AM #10WHT Addict
- Join Date
- Feb 2011
- Posts
- 115
Hmmm, can I use multi options for example, --skip-opt and --compact
?
-
02-11-2011, 11:57 AM #11Web Hosting Master
- Join Date
- Nov 2006
- Location
- Karachi, Pakistan
- Posts
- 1,359
Similar Threads
-
mysqldump (Backup using ssh) not completed, & please advice my.cnf
By basketmen in forum Hosting Security and TechnologyReplies: 2Last Post: 11-13-2010, 06:23 AM -
mysqldump problem
By nomankhn in forum Hosting Security and TechnologyReplies: 7Last Post: 05-06-2010, 08:23 AM -
mysqldump problem
By xserverx in forum Hosting Security and TechnologyReplies: 13Last Post: 09-06-2009, 08:41 AM -
mysqldump in ssh
By apacheMan in forum Hosting Security and TechnologyReplies: 4Last Post: 01-27-2008, 03:45 PM -
ssh problem
By snakey in forum Hosting Security and TechnologyReplies: 7Last Post: 08-31-2004, 07:23 PM