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.
Who is Participating?
DougPrattConnect With a Mentor Author 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.
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
All Courses

From novice to tech pro — start learning today.