Gossamer Forum
Home : General : Perl Programming :

Darn mysql dump...

Quote Reply
Darn mysql dump...
Ok, I'm still playing with how to do a SQL Dump into a file. So far I've got;

mysqldump -C -h localhost -u myusername -p mypassword dump1 [links_CatLinks, links_CatRelations, links_Category, links_Category_Score_List, links_Category_Word_List, links_Changes, links_ClickTrack, links_Editors, links_EmailMailings, links_EmailTemplates, links_Links, links_Links_Score_List, links_Links_Word_List, links_MailingIndex, links_MailingList, links_MailingListIndex, links_Users, links_Verify] > /home/ace-host/public_html/small_dumps/test.dump.sql;

However, that command gives me errors. Anyone able to help? This is the 3rd day I've been working on trying to get this going...and as you can see I'm not having much luck Frown

Thanks for any help you can give me

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
Are you trying to dump via a perl script or the command line?

If its the command line look here:

http://www.mysql.com/doc/m/y/mysqldump.html

You don't include all the table names like that.
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Yeah. I've been there. I tried;

mysqldump --opt database > backup-file.sql (suggested at the bottom of the page)...but it said that there was an error in my formattion Unsure All i did was change the database name....so knowing my luck I forgot some major stuff in it Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
Try changing --opt with --u username -p password -h hostname Cool
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Still errors;

ERROR 1064: You have an error in your SQL syntax near 'mysqldump -h localhost -u myusername -p mypassword database > backup-file.sql' at line 1 (I've taken out the username and password obviously Wink)...

Any ideas?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
Are you using TextPad to copy/paste the command by any chance?

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Darn mysql dump... In reply to
Yeah, I'm using SecureCRT, with the paste function. Why, is there a problem with that?? Unsure

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Eraser] Darn mysql dump... In reply to
Well, turned out that I was doing part of it wrong Wink I was using the mysql> instead of the actual command line. I am now trying to use;

mysqldump –u root –p mypassword –h localhost mysqldatabase > backup-file.sql

However, this gives me an error saying that backup-file.sql has permission denied. I tried entering up the full path to where I want the backup file to go, but when I do that it starts asking me for a password!

Anyone got any ideas?

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

AndyNewby: Jan 13, 2002, 5:55 AM
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
The folder where the .sql file is created needs to be set to 777.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Heckler] Darn mysql dump... In reply to
Hi Eliot. I'm kinda getting there now Wink (using a - in the file name was why I was getting permission denied).

Still got other problems though. Now using;

/usr/local/mysql/bin/mysqldump–-u root –-p mypassword -–h localhost dump1> /home/ace-host/public_html/small_dumps/backupfile.sql

I get;

sh: /usr/local/mysql/bin/mysqldump–-u: No such file or directory

Further up, Eraser said that copying and pasting could cause problems. For that reason I typed out everything. However, I'm still getting the error;

/home/ace-host/public-html/small_dumps/backup.sql: No such file or directory (small_dumps is set to 777 BTW).

Any ideas?

Maybe just using a Perl SQL command to do this would have been easier Tongue I'm only doing this so I can backup my SQL databases every 2 weeks Unimpressed

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
>>sh: /usr/local/mysql/bin/mysqldump–-u: No such file or directory <<

I can't believe you didn't spot the error Tongue

Try adding a space between the path to mysqldump and -u

Your second error is also foolish Cool

Your path is ace-host.com

That is like the first thing you should check.

Last edited by:

RedRum: Jan 14, 2002, 3:33 AM
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Oh and you'll need public_html not public-html
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Errr, Paul, I did have ace-host.com as the part to start with! But I was trying it with just ace-host (don't ask me why Wink) I also tried it with CD'ing to the actual folder where it should be able to run fine, and then just using the name itself, without the folder paths.

As for the second error, I was using;

/usr/local/mysql/bin/mysqldump -u bla bla

However, for some reason when copying and pasting it changes spaces to -, thus it being as it was. I tried just typing it manually. I.e;

/usr/local/mysql/bin/mysqldump -u mysername -p mypassword -h localhost databasename > mydump.sql

However, that didn't work either Wink Permission denied even though the directory was set to 777 Frown

Does anyone actually have a tried and tested method of backing up their database via SSH? I'm fed up searching and it not working...I just want it to work....lol Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
You are using the _wrong_ path .....sigh

I guess Im going to have to paste it for you....

/home/ace-host.com/public_html/small_dumps

Try doing it as root!

Last edited by:

RedRum: Jan 14, 2002, 3:33 AM
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
YES I KNOW Wink

Ok, used;

> /usr/local/mysql/bin/mysqldump -u root -p rootpassword -h localhost dump1 > /home/ace-host.com/public_html/small_dumps/dump.sql
Enter password: /usr/local/mysql/bin/mysqldump: Got error: 1045: Access denied for user: 'root@localhost' (Using password: NO) when trying to connect

Ahem Wink

As you can see it didn't work Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
Thats nothing to do with the wrong path, it means your login details are wrong.
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Well, they arn't wrong Wink Obviously I changed the password before pasting it here publically, but the one I am using is correct! I have been using it fine with loads of other scripts. I even tryed using the admin one we created, and that still gets errors! If you want I give you permission to go in on my server and try to get that command to work. I betcha it won't Tongue (you know where to go Wink)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
What I don't understand is why it is saying i'm NOT usign a password, when i blatently AM using -u and -p in the string! Is -p not correct for the password?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
I was just gonna say that. It seems to say NO.

Hmm send me the database name and root pw via pm or IM.
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
Ok, PMed you!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
OMG! I CAN'T BELEIVE IT! All I needed to do was use --user=uername and --pass=password

I.e;

/usr/local/mysql/bin/mysqldump --user=root --pass=mypassword -h localhost dump1 > /home/ace-host.com/public_html/small_dumps/dump.sql

God I can't believe it was only that!

Thanks anyway Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
You didn't need that :)

I hate to blow my own trumpet but it worked first time. Tongue

I used:

/usr/local/mysql/bin/mysqldump -uroot -ppass dump1 > file2.sql

So you'll see file2.sql in there now.

Last edited by:

RedRum: Jan 14, 2002, 4:05 AM
Quote Reply
Re: [RedRum] Darn mysql dump... In reply to
You used -uusername, without the space?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Darn mysql dump... In reply to
Yup