Nov 21, 2009
Pages: 1, 2

Can't Import Backup Sql File To Localhost

free web hosting

Read Latest Entries..: (Post #11) by iGuest on Aug 28 2009, 03:14 PM.
Hi, Kindly read very usefull article for huge sql data uploading at http://www.Nobleatom.Com -reply by khubab1
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Databases

Can't Import Backup Sql File To Localhost

WeaponX
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:

QUOTE
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.

 

 

 


Comment/Reply (w/o sign-up)

yordan
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.

Comment/Reply (w/o sign-up)

vhortex
QUOTE(yordan @ Feb 26 2007, 11:32 PM) *
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. mellow.gif

Comment/Reply (w/o sign-up)

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

You said....
QUOTE(WeaponX @ Feb 25 2007, 09:40 PM) *
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
CODE
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

Comment/Reply (w/o sign-up)

pyost
Actually, if my memory serves me well, those files are being exported as backup.sql.gz. Or maybe not unsure.gif Try both smile.gif

Comment/Reply (w/o sign-up)

bluefish
If WAMP has phpMyAdmin, I would suggest to just use that utility. You would avoid any possible syntax problems, not to mention it is just easier. tongue.gif

Comment/Reply (w/o sign-up)

WeaponX
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? biggrin.gif

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 smile.gif

Thanks for all the replies.

 

 

 


Comment/Reply (w/o sign-up)

yordan
QUOTE
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.

Comment/Reply (w/o sign-up)

WeaponX
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 smile.gif

Comment/Reply (w/o sign-up)

kentweather
any one know how to get the weather.com xml feed code woking does it require a mysql database

Comment/Reply (w/o sign-up)

Latest Entries

iGuest

Hi, Kindly read very usefull article for huge sql data uploading at http://www.Nobleatom.Com

-reply by khubab1

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : import, backup, sql, file

  1. Mysql And User File_priv
    (0)
  2. Mysql Backup With Another Address?
    (4)
    I just got my site hacked!! (don't worry because it is not on astahost) Actually it is a
    wordpress blog. So I backed up my MySQL Databases with cpanel. Now when I get my hosting approved
    here at astahost, can I restore those backups? Is the change of the site address going to interfere
    with this? Is there anyway I can edit those databases to work with my new address? Please help me
    out here!....
  3. Read/Write Issues After Copying An Access .mdb File
    (4)
    Alright, I'm currently creating an interface program for a MS Access database. I've only
    used Access once in the past but used other DB's a handful of times so I didn't have any
    trouble getting the general program created. My issue arose when I tried to make it so that the
    users needing to use the program can just copy the .exe and the .mdb files and use it. The program
    doesn't require users to share the database but to store their OWN programs information in their
    OWN database, so basically each needs to have their own database with the exact same d....
  4. How To Restore A Sql.gz File
    (5)
    How do i restore a sql.gz file? Im confused /mellow.gif" style="vertical-align:middle"
    emoid=":mellow:" border="0" alt="mellow.gif" />....
  5. Restore Database Backup Locally?
    (7)
    I wanted to use my live forum database (in another webhost) on Astahost for testing purposes. But I
    guess the free accounts we have do not support that restore backup option...tried it and got a
    message saying that. Is there any way we can do this locally? I will probably install XAMPP or one
    of the variants of those packages. I don't assume cPanel can be included also locally? If not,
    I just want to know how I can use the database from my live forum in my own computer. Thanks.....
  6. How Do I Do A MySQL Backup
    how? (7)
    I have been trying forever to save MySQL database. There is no Backup option on the cPanel, so what
    do I do? Is there a way to do it from phpmyadmin? Someone help me! Thanks.....
  7. Auto-backup Your MySQL DBs Daily/weekly/monthly
    (9)
    Hi folks, I just came across this cool shell script called automysqlbackup which takes on
    certain parameters such as your user/pass/host address/database names and performs automatic
    daily/weekly/monthly backups of your databases as configured. The script is ready to run and need
    very little configuration - only in the top part: QUOTE
    #=====================================================================
    #===================================================================== # Set the following variables
    to your system needs # (Detailed instructions below variab....
  8. Recover Tables From A MySQL .frm File
    (9)
    I have a couple of .frm files with no corresponding data or index files. Is it possible to recover
    the table structure (field names, types, sizes, rows,col, etc) from these files? The table type is
    innodb....
  9. Tired Of The DB Import/Export Tools
    just a Rant... (3)
    I'm sick & tired of the commercial/freeware DB Import/Export tools - the limitations they have
    and the complex process involved in some - and yet their failure to update data properly in most
    cases. I've used most of the EMS series of mysql imp-ex utils and am not at at happy with the
    result (specially abt it's incapability to transfer unicode data). So I'm off to write one
    on my own that'll be simple and versatile. It'll either be designed in C# or VB.NET or both.
    Features would include: 1. A Very Simple Interface where the noobs of noobs can jum....
  10. How Can I Import Csv Files To My MySQL Database?
    I was able to export but where's import? (3)
    I am having hard times finding that import csv in the mysql phpmyadmin. I once worked on some csv
    files and someone imported it on the mysql server. I was not able to ask him. Does someone know how
    can I import csv files in mysql server?....
  11. How Can I Backup MySQL Database On Cpanel?
    a silly question (7)
    I dont know how to backup the database to my computer , in cPanel i click "export" (is that right),
    but i can't back the file to my computer >.<....
  12. Sample My.cnf - MySQL Configuration File
    if you need as startup (2)
    Hi all, Recently there has been lots of questions about configuring MySQL. Usually the rpm
    comes with a few sample MySQL config files, but here I'm providing you with a fully working one
    for your reference. Feel free to modify it to suit your needs. One word: My MySQL is configured to
    use only large InnoDB Databases, because of the large volume of transactions it handles. You'll
    find a reflection of that in the my.cnf... Most home users would use ISAM DB instead. So make the
    suitable modifications before you use... Sample "my.cnf" QUOTE #-----------....
  13. One suggestion about database backup
    (1)
    Suppose there are lots tables in your database instance, and there maybe lots data within them.
    Backup task may cost u many time. What I suggest here is to add one more table in the instance,
    which contains the current delta of every other tables. Structure of TblLogs: 1) record id, to be
    the index of this table, maybe automatic increased. 2) tableName, contains the name of every table
    3) delta can be a int type. increase every time when the certain table is modified (ignore of
    select operation). With such table, we are able to develop a application, which check if....
  14. MySQL Backup
    (1)
    Does this control panel allows backup of the database it has. Because i will need it.....
  15. How to Backup MySQL Database
    (16)
    in mysql install directory: \mysql\bin>mysqldump -u root -p root your_DB_name > back.sql....
  16. Database Backup
    (2)
    I've a mySQL database backup which I used with my blog at another host which went down. I would
    like to restore my blog to what it was the other time. I wonder if I upload the blog installation
    files, restored the database backup, then specify the blogging program to use the restored database,
    will everything then turn out fine? Need help urgently, thanks /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....

    1. Looking for import, backup, sql, file

See Also,

*SIMILAR VIDEOS*
Searching Video's for import, backup, sql, file
advertisement



Can't Import Backup Sql File To Localhost

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com