PDA

View Full Version : restore problem


Razgo
Sun 19th Jan '03, 7:53pm
I have read through many threads here concerning how to restore a database. but i still have trouble restoring it.

using SSH: mysql -uUSERNAME -pPASSWORD databasename < /path/to/file

it keeps telling me that the file or directory doesn't exist. but it does. so i can only guess it can't find that path from the promt and i don't know why.

i moved from one host to another recently and the host reestored it for me, but said it was corrupted and he copied chinks at a time to get it going. the forum was fine.

however i moved again and i am on a friends dedicated server and he knows nothing about this sought of thing.

phpmyadmin tells me my sql query was excecuted successfully. but nothing appears.

i even tried an older backup from last october but it only installed 13 tables.

anyhow i am at a loss on what to do next.

Steve Machol
Sun 19th Jan '03, 7:57pm
I'm confused. Are you trying to restore via the shell (ssh) or phpMyAdmin. You mention both processes. Perhaps if you explain exactly what you are doing we can then help.

Razgo
Sun 19th Jan '03, 8:00pm
hi steve, it was 2 different methods i used on seperate occasions.
in other words i tried both ways to see if i could restore it.

and neither method worked for me.

Steve Machol
Sun 19th Jan '03, 8:01pm
To help, I'll need to know exactly what you did using the ssh method.

Razgo
Sun 19th Jan '03, 8:06pm
with the SSH method i did this.

logged in first.

then at the promt i typed:

mysql -uUSERNAME -pPASSWORD databasename < /path/to/file/backup.sql

then hit enter. i then get an error saying the directory or file does not exist.

NTLDR
Sun 19th Jan '03, 9:33pm
Originally posted by Razgo
with the SSH method i did this.

logged in first.

then at the promt i typed:

mysql -uUSERNAME -pPASSWORD databasename < /path/to/file/backup.sql

then hit enter. i then get an error saying the directory or file does not exist.

Make sure its the full path, which probably isn't the one you see in your ftp client. Type PWD to see the full path to where you currently are, alternativly make sure your in the directory with the backup and use:

mysql -u USERNAME -p db_name < backup.sql

It should prompt for your password and then start importing, it may take a while if you have a large database.

Steve Machol
Sun 19th Jan '03, 9:41pm
Originally posted by Razgo
with the SSH method i did this.

logged in first.

then at the promt i typed:

mysql -uUSERNAME -pPASSWORD databasename < /path/to/file/backup.sql

then hit enter. i then get an error saying the directory or file does not exist. Sorry, perhaps I wasn't clear. I meant to post the *exact* command you used.

Razgo
Sun 19th Jan '03, 9:51pm
that is the exact command. except replace username and password with my username and password.

this is my phpinfo: phpinfo (http://www.dvdcritique.com/phpinfo.php)

when i type in PWD at the shell promt it tells me /home/razgo

the path to the file i was using was /home/virtual/site4/fst/var/www/html/backup.sql

i know something doesn't look right there?

my database is less than 4meg in size.

i don't know how to get to the directory where the file is via SSH. i'm lost when using SSH.

Steve Machol
Sun 19th Jan '03, 10:02pm
That's what I wanted to knwo - the path you were using. How do you know the backup script is in that directory? Have you trtied to change to that directory and look for it?

cd /home/virtual/site4/fst/var/www/html/

Razgo
Sun 19th Jan '03, 10:05pm
when i type in

cd /home/virtual/site4/fst/var/www/html/

i get an error telling me there is no such file or directory.

i know the file is there because i FTP upload the file to that location.

but because i can't even change to that directory i guess this is the main problem.

Razgo
Sun 19th Jan '03, 10:07pm
it's almost like my site doesn't exist?

Steve Machol
Sun 19th Jan '03, 10:07pm
Hmmm...I don't know hhow you could have uploaded it to a directory that doesn't exist. :confused:

What happens if you do this:

cd www/html

then:

ls

Do you see backup.sql?

Razgo
Sun 19th Jan '03, 10:14pm
ok the plot is thickening.

when i typ cd www/html i get error telling me it doesnt exist.

when i type

ls

i get: backup.sql main mainwebsite_cgi mainwebsite_html mainwebsite_perl

yes i did put the backup.sql file there also as i was trying different locations to restore it from.

Steve Machol
Sun 19th Jan '03, 10:16pm
Okay, we're getting somewhere. In this case, stay in that directory and use:

mysql -uUSERNAME -p databasename < backup.sql

You should then be prompted for your db password.

Razgo
Sun 19th Jan '03, 10:23pm
ok now i get an error:

1130: host ' localhost.localdomain' is not allowed to connect to this mysql server.

Steve Machol
Sun 19th Jan '03, 10:25pm
Is the MySQL server on a different machine? What's the contents of the $servername variable in config.php?

Razgo
Sun 19th Jan '03, 10:27pm
hang on i was using my databse username. i will try my FTP username now.

Steve Machol
Sun 19th Jan '03, 10:28pm
Originally posted by Razgo
hang on i was using my databse username. i will try my FTP username now. You're supposed to use your db username.

Razgo
Sun 19th Jan '03, 10:30pm
Originally posted by Steve Machol
You're supposed to use your db username.

ah ok, i was right the first time then.

Is the MySQL server on a different machine? What's the contents of the $servername variable in config.php?

how do i find this out?

Steve Machol
Sun 19th Jan '03, 10:34pm
First of all, does your friend even have MySQL installed on your server?

Look at the contents of your config.php file. You can download it to your home machine and open it with Notepad.

Razgo
Sun 19th Jan '03, 10:37pm
Originally posted by Steve Machol
First of all, does your friend even have MySQL installed on your server?

Look at the contents of your config.php file. You can download it to your home machine and open it with Notepad.

i have a fresh vbulletin installed and also an xoops databse installed. so the answer should be yes.

Razgo
Sun 19th Jan '03, 10:40pm
can you have a quick look if i give you my SSH details?

Razgo
Sun 19th Jan '03, 10:44pm
come to think of it he has 2 servers. both are rackshack servers. i am sharing his second server. how do i find out where mysql is on the server?

Steve Machol
Sun 19th Jan '03, 11:05pm
What do the contents of your config.php file sho for $servernamew?

When you moved to your friends server, did you create a db user, password and db to import bthe backup into?

Razgo
Sun 19th Jan '03, 11:07pm
also i can access the root of the server using another login name and password if i have to.

i FTP to my account and found that backup.sql file had a size of 0 bytes. so it is now located /home/virtual/site4/fst/var/www/html/backup.sql

Razgo
Sun 19th Jan '03, 11:10pm
What do the contents of your config.php file sho for $servernamew?
where do i find this file?

no i didn't create a username and password. he had already done that. since then i have created 3 database names. 2 in use and the one i am trying to use now.

the one i created for vbulletin to restore to is called vbull2

Razgo
Sun 19th Jan '03, 11:12pm
ok you mean my vbulletin config file? it says: "localhost"

Steve Machol
Sun 19th Jan '03, 11:12pm
Please read my previous messages.

As for the backup file, I have no idea what could have happened to it. However if it's 0 bytes, then it's no good anymore.

Also in general it's a very bad idea to host on a server in which the person running it doesn't know the first thing about it. I strongly recommend you find a competent host for your forums.

Steve Machol
Sun 19th Jan '03, 11:13pm
Originally posted by Razgo
ok you mean my vbulletin config file? it says: "localhost" Then this means that your friends server is not set up correctly for MySQL. Also once again, did you create a new db user, password and db name?

Razgo
Sun 19th Jan '03, 11:15pm
did you create a new db user, password and db name

no, i only created the new databases.

Steve Machol
Sun 19th Jan '03, 11:18pm
You will need to create the new db user, password and db, then assign that db user to that db.

However this will only help if that server is properly configured with MySQL, which it would appear it's not given this error:

1130: host ' localhost.localdomain' is not allowed to connect to this mysql server.

Razgo
Sun 19th Jan '03, 11:19pm
why does $servername="localhost";

mean it's not set up right? thats what it always says no matter what server i have been on.

you mean this is why i can't use SSH restore?

Razgo
Sun 19th Jan '03, 11:21pm
ok i will go and give that a try then

thanks

Steve Machol
Sun 19th Jan '03, 11:22pm
Originally posted by Razgo
why does $servername="localhost";

mean it's not set up right? thats what it always says no matter what server i have been on.

you mean this is why i can't use SSH restore? See the previous error. That server is not allowing connections from localhost.

Razgo
Sun 19th Jan '03, 11:28pm
ok i understand now.

however I have a fresh install of vbulletin working and also xoops that use "localhost"

this server uses ensim and i can create a new user, but i don't think i can assign that user to a database.

currently i just use the same username and password for my other 2 databases and any new database i create.

Steve Machol
Sun 19th Jan '03, 11:32pm
Originally posted by Razgo
ok i understand now.

however I have a fresh install of vbulletin working and also xoops that use "localhost"

this server uses ensim and i can create a new user, but i don't think i can assign that user to a database.

currently i just use the same username and password for my other 2 databases and any new database i create. Sorry but I don't know where that leaves us. If you have another backup.sql file, upload it and try to restore again. If you get the same error, then it's a server issue and your friend will need to get help resolving it.

Razgo
Sun 19th Jan '03, 11:40pm
steve, there is a new development, i have now logged into the root of the server and was able to get into that path now.

i did the following

cd /home/virtual/site4/fst/var/www/html/

then typed "ls" and i can now see my backup.sql

i'm a liitle scared now as i have to make sure i do the right thing and not stuff anything up here.

Razgo
Sun 19th Jan '03, 11:44pm
will it now be safe tp type the following?

mysql -uUSERNAME -p databasename < backup.sql

?

it won't blow up the server?

Razgo
Sun 19th Jan '03, 11:54pm
i'm not sure if i should proceed now as it looks like steve is gone....

Steve Machol
Sun 19th Jan '03, 11:56pm
Originally posted by Razgo
i'm not sure if i should proceed now as it looks like steve is gone.... Nope, just taking a break to eat something. I don't asee any harm in trying the restore again. Just make sure you have a good backup copy of backup.sql.

Razgo
Sun 19th Jan '03, 11:59pm
yeh a man has to eat :)

ok i did that command and now i get this message saying:

you have new mail in /var/spool/mail/root

what has happend?

Razgo
Mon 20th Jan '03, 12:02am
i logged into myphpadmin and can now see the new database filled!! so i will go and see if the forum works now.

what do you think that mail thingy is?

Steve Machol
Mon 20th Jan '03, 12:02am
It sounds like the restore completed without error.

Razgo
Mon 20th Jan '03, 12:16am
ok the forum has now reappeared after i edited the config file to reflect the database. it is as slow as a wet wick but lots of images i had there before missing. i might revert all the files to get it back to normal and go from there.

so my problem must have been to do with my username and password not being cinfigured right to use SSH to do things? i dunno, but in the end i got there.

thanks very much for your patients and time!