PDA

View Full Version : backing up database (different question)


riiibbiit
Tue 28th May '02, 6:54am
First, yes, I did search through the forum, and no, I did not find an answer to what I'm looking for :) ;)

I am backing up my database to switch to a new server, since I'm using too much bandwidth where I am now. Logging into MySQL is fine, using mysqldump is fine, but after entering the command it does not do anything except create a blank file (the one I specified and where I specified it to be) ...

Here's exactly what I did:

bash-2.04$ mysql -u collinraye -h collinraye.net -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3477 to server version: 3.23.36

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> mysqldump --opt -u collinraye -p collinraye_net > /home/collinraye/mainwebsite_html/backup/fback.sql


After entering that, it just gives me "->" and sits there... the file "fback.sql" exists under the directory "backup", but it is completely blank. It's not that I'm not giving it enough time, my database is only about 40MB and when I first executed the command I left while it was working to take a shower, forgot about it, and left it sitting for well over an hour after that. Can't possibly take that long. It might be because it's so late and I'm so tired, and entered something incorrectly, but I've gone over it a dozen times and I don't think I'm doing anything wrong.

Thanks.

mcncyo
Tue 28th May '02, 7:52am
you don't need to login into mysql to do a dump just type mysqldump from the command line, and this will log you into mysql automaticly and create the file for you basicly you don't have to do the following


bash-2.04$ mysql -u collinraye -h collinraye.net -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3477 to server version: 3.23.36


All you need to do is

bash- 2.04$mysqldump --opt -u collinraye -p collinraye_net > /home/collinraye/mainwebsite_html/backup/fback.sql

riiibbiit
Tue 28th May '02, 4:19pm
I have to login first... otherwise I get a completely different error. I don't see how this would matter, though, would it?

eva2000
Tue 28th May '02, 4:57pm
Originally posted by riiibbiit
I have to login first... otherwise I get a completely different error. I don't see how this would matter, though, would it? all you need is


mysqldump --opt -u collinraye -p collinraye_net > /home/collinraye/mainwebsite_html/backup/fback.sql

you can't do it from mysql client

what error are you getting ?

riiibbiit
Tue 28th May '02, 5:16pm
Why can't you? That's kind of stupid, heh...

Anyway:

bash-2.04$ mysqldump -u collinraye -p collinraye_net > /home/collinraye/mainwebs
ite_html/backup/dump.sql
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '
/var/lib/mysql/mysql.sock' (111) when trying to connect

I sent this in as a ticket to my host to see if they knew what was wrong, and the woman I spoke with said to login to MySQL first, so I did, and then I get the "->" deal where it creates a blank file and nothing else when I use mysqldump. Thank God I'm still keeping the host that my forum is on now, and not completely losing them to go elsewhere :) So I have all the time in the world to figure out what's wrong before I transfer my forum to a new server.

eva2000
Tue 28th May '02, 5:47pm
Originally posted by riiibbiit
Why can't you? That's kind of stupid, heh...

Anyway:

bash-2.04$ mysqldump -u collinraye -p collinraye_net > /home/collinraye/mainwebs
ite_html/backup/dump.sql
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '
/var/lib/mysql/mysql.sock' (111) when trying to connect

I sent this in as a ticket to my host to see if they knew what was wrong, and the woman I spoke with said to login to MySQL first, so I did, and then I get the "->" deal where it creates a blank file and nothing else when I use mysqldump. Thank God I'm still keeping the host that my forum is on now, and not completely losing them to go elsewhere :) So I have all the time in the world to figure out what's wrong before I transfer my forum to a new server. she doesn't know what she's talking about you can not log into mysql client and do a mysqldump!

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

can you post the whole error after the part 'when trying to connect to....;

if you're using cpanel based host double check your

mysql username for correct spelling and format

it should be

siteusername_mysqlusername

riiibbiit
Tue 28th May '02, 6:45pm
Well, I dunno enough about MySQL to say anything about that, so I won't :) All I know is that I did the mysqldump and got this error, e-mailed my tech support and that's what she said to do. I did what she said, and at least didn't get an error, but rather didn't get anything at all, heh.

That is the entire error that I get, the one I posted:

bash-2.04$ mysqldump -u collinraye -p collinraye_net /home/collinraye/mainwebsit
e_html/backup/dump.sql
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '
/var/lib/mysql/mysql.sock' (111) when trying to connect
bash-2.04$

I know that my MySQL username is correct, because it's the same as my ftp username, telnet/ssh username, and control panel username, each of which I've typed too many times to not have right :)

eva2000
Tue 28th May '02, 6:52pm
Originally posted by riiibbiit
Well, I dunno enough about MySQL to say anything about that, so I won't :) All I know is that I did the mysqldump and got this error, e-mailed my tech support and that's what she said to do. I did what she said, and at least didn't get an error, but rather didn't get anything at all, heh.

That is the entire error that I get, the one I posted:

bash-2.04$ mysqldump -u collinraye -p collinraye_net /home/collinraye/mainwebsit
e_html/backup/dump.sql
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '
/var/lib/mysql/mysql.sock' (111) when trying to connect
bash-2.04$

I know that my MySQL username is correct, because it's the same as my ftp username, telnet/ssh username, and control panel username, each of which I've typed too many times to not have right :) is mysql on the same server as your forums or a separate server ?

try


mysqldump -u collinraye -p -h mysqlhostname collinraye_net /home/collinraye/mainwebsit
e_html/backup/dump.sql
where mysqlhostname is the name of your server's hostname

read http://www.mysql.com/doc/C/a/Can_not_connect_to_server.html

riiibbiit
Tue 28th May '02, 7:36pm
Well I had posted something, but nevermind, I noticed something I did wrong and will try it now.

Steve Machol
Tue 28th May '02, 7:38pm
You forgot the '>', didn't you? ;)

eva2000
Tue 28th May '02, 7:40pm
Originally posted by smachol
You forgot the '>', didn't you? ;) doh!! ...

riiibbiit
Tue 28th May '02, 7:42pm
You hadn't put the redirect ">" in the last line you told me to try, and I didn't notice until after I got some other error and posted a reply with it :)

Works now:

bash-2.04$ ls -l
total 48988
-rw-rw-r-- 1 collinra collinra 50106893 May 28 18:38 dump.sql

You're a saint, thanks so much :) ;) :D

riiibbiit
Tue 28th May '02, 7:43pm
Originally posted by eva2000
doh!! ...

Yep, only you got to replying before I did :)

riiibbiit
Tue 28th May '02, 7:44pm
Originally posted by smachol
You forgot the '>', didn't you? ;)

Thanks smachol, yes, I didn't even notice it until afterwards, and until after I posted, heh :) ;)

riiibbiit
Wed 29th May '02, 4:50am
Just wanted to say that I'm doing my move right now, and everything is going wonderful, thanks again so much for your help everyone :) ;) :D :p

Woohoo!! Done, great stuff :D :)