MySQL backup won't import

I can't get a backup of MySQL from one host to import on another. I get this error:

SQL query:

# WordPress MySQL database backup
#
# Generated: Saturday 27. March 2010 18:57 EDT
# Hostname:
# Database:
# --------------------------------------------------------
# --------------------------------------------------------
# Table: `wp_comments`
# --------------------------------------------------------
#
# Delete any existing table `wp_comments`
#
DROP TABLE IF EXISTS  `wp_comments` ;

I made another backup, but without the wp_comments table, but when I try to import that, it says the next table name should be dropped. This database is working fine where it is.
DougPrattAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gtkfreakCommented:
Have you tried this:
mysqldump -u root -p <database> --add-locks --complete-insert --flush-privileges -R --triggers > <target_txt_file>

where <database> should be replaced with your database name.
and <target_txt_file> replaced with the target text file that you need to backup.

The above command will create code for DROP as well. Use:
mysqldump --help to refer to the options for backing databases.

To import back on the other system, you can use:
mysql -u root -p <database> < <target_txt_file>
where <database> should be replaced with the name of your database and
<target_txt_file> should be replaced with the target
0
DougPrattAuthor Commented:
The answer turned out to be very simple -- importing a MySQL database cannot create a database. First, create the database, or delete the tables of an existing database, then do the import of the backup file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.