Jump to content
xisto Community
WeaponX

Can't Import Backup Sql File To Localhost

Recommended Posts

Hi, I downloaded a backup of my forum database and wanted to import it on my computer locally for testing purposes. This has always worked for me in the past, but I'm having some problems with it lately.

 

I'm backing up my database via phpMyAdmin->Database->Export->Select All and downloaded as a .gz file.

 

I'm using Windows XP Home with WAMP installed, so it has MySQL built in. It's version 5.0.27.

 

I ran all the services and at the prompt typed in:

 

mysql -u root -p backup.sql > testDB

 

My root account in WAMP has no password, so when it prompts for a password, I just hit ENTER. Then it shows me this error:

 

ERROR 1102 (42000): Incorrect database name 'backup.sql'

The path and filename are 100% correct....I'm positive on this. I downloaded the .gz file and had to extract it to get this SQL file. I have done this numerous times in the past without any issues.

 

I tried restarting the service and even as far as reinstalling the whole WAMP package, but to no avail.

 

Can anyone shed some light on this issue?

 

Thanks.

Share this post


Link to post
Share on other sites

have a look a the mysql exact syntax. the error message says that you forgot givint the database name. I guess that "backup.sql" is effectively the name of your backup sql script, so the error message is correct, the database name has not been supplied.

Share this post


Link to post
Share on other sites

have a look a the mysql exact syntax.

the error message says that you forgot givint the database name. I guess that "backup.sql" is effectively the name of your backup sql script, so the error message is correct, the database name has not been supplied.


mysql -u root -p backup.sql > testDB

 

looking at this one.. i think that the database name was testDB, maybe just a syntax error. ;)

Share this post


Link to post
Share on other sites

I would have to say that maybe the filename that you are giving it is incorrect....

You said....

downloaded as a .gz file

I think that would indicate that the file is something like backup.gz right?

If that is the case...I think the correct stuff at the prompt would be something along the lines of
mysql -u root -p backup.gz > testDB
Notice that i changed the .sql to .gz....

Hopefully that helps, and if you were already doing that...i'm not exactly sure what is wrong....other than maybe it isn't liking the blank root password...

Well anyhow,

Good luck, and hopefully something somebody said here helps,
Brian
Edited by .:Brian:. (see edit history)

Share this post


Link to post
Share on other sites

Trust me guys, I tried everything I could think of. In terms of the name, I just used backup as an example here. It's actually using my full name to create the backup followed by .sql.gz as mentioned above. The thing is that this .gz file is compressed and MySQL won't import it as it is right? So I had to extract it to get the full SQL file. I have done this exact procedure numerous times in the past before without encountering this kind of issue.

 

I'm using root without a password since this is done locally. But it prompts me for the password after I type that line in and hit Enter. Blank password either way...

 

Yes, "backup.sql" is the name of the file (I even checked in the command prompt to verify that there's no other extension after that) and testDB is the database I want this backup to go into. I already created that testDB file in phpMyAdmin if that helps because I recall that it will complain if it doesn't exist already...now that I think about it, might as well try it without creating it first. I doubt it will work...

 

Any other suggestions? ;)

 

UPDATE:

 

OK, something is definitely "screwy" here. I typed in:

 

mysql -u root -p testDB < backup.sql

 

and that actually worked this time. I know the example I mentioned above is different from this, but I have also tried this recent command before and it failed. It worked today for some strange reason. I was even able to create that "testDB" database without creating it first in phpMyAdmin. But after playing around with it more, I couldn't copy the backup.sql file into another "non-existent" database without creating first.

 

All well...Just glad it's imported now ;)

 

Thanks for all the replies.

Share this post


Link to post
Share on other sites

mysql -u root -p testDB < backup.sql

This is the correct syntax.the user named "root" would like to execute the sql script named "backup.sql" in order to upload into the "testDB" database.
Now, the correct syntax gives correct result, we can startup talking about normal things.
Now, next time, if the same syntax does not work, this will mean that the "backup.sql" file is corrupted. Or that the "testDB" database has a problem.
But, right now, let's be happy that a correct command line applied to a correct sql script gave us correct results.
Edited by yordan (see edit history)

Share this post


Link to post
Share on other sites

It's just been a while since I worked with mysql that I forgot the proper syntax. I thought I did it the other way and it worked in the past....I'm just glad it's working now ;)

Share this post


Link to post
Share on other sites

@kentweather, please don't post your question into someone else's (mine in this case ;)) topic. Create your own next time and someone will reply to it if they know of a solution.

In regards to your question, take a look at:

https://weather.com/weather/rss/subscription?from=footer

They have instructions in the links there. You will need to use a RSS Feeder program to subscribe and download the feeds.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.