Error 1050 (42S01) restore database

January 2, 2015 2.9k views

I am migrating my site from interserver shared hosting to your digital ocean server.

I have created the droplet and installed wordpress (by using your 1 click wordpress install feature).
Wordpress was working fine on my localhost.

After that i started the migration process.

By using filezilla i have copied my wp-content folder to my server.
After that i just have to restore my database.

As i have no technical knowledge. I can't install phpmyadmin on server. I have followed your post on "How to migrate wordpress site to our server." And i found this command.

mysql -h localhost -u databaseuser -p databasename < backup_db.sql.gz

{I have replaced database user, database name and the file name}

After entering that command i am getting this error.

Error 1050 (42S01) at line 28: Table 'wp-commentmeta' already exists

Please help me to restore my database and in resolving this issue.

Thank You

2 Answers

You are encountering this because your backup includes queries to create the needed tables. Since you are using the one-click image these tables already exist. You should be able to import your backup by first deleting the existing tables. The easiest way to do this would be to delete the current database and then re-create an empty one with the same name before doing your import.

mysql -u databaseuser -p

will get you an interactive prompt, then run:

drop database databasename;
create database databasename;

Now you can use the import command you included in your question to import your backup.


Glad to see you're making the move! Congrats! With that said....

RE: phpMyAdmin

phpMyAdmin is a download & upload piece of software. It only requires configuration & setup if you need to go more in-depth. I've used it countless times to get in, do things a little quicker than I could via CLI, and then be done with it (I just deleted the files).

All you need to do is download it, extract it (just as you would WordPress), and then upload it to a new folder - say dbadmin (perhaps something a bit less common, this is just to give you an idea). Keep it out of the WordPress directories though.

Once the files are uploaded, browse over to the directory where you uploaded the files and log-in with your WordPress DB User & Pass (from your wp-config.php file).

Here's the link from their GitHub page:


RE: Technical Experience

This is advice I give to anyone who makes a comment regarding technical experience, so please don't take it the wrong way :-).

Your venturing from local where your the only one with access (in most cases) and shared hosting (where sysadmins and DBA's setup, configure, secure, optimize servers + numerous other things) in to a world where you're really on your own and it's your job to handle these things.

The images DigitalOcean provides are just that, base images designed to get you up & running quickly. You still need to handle security, optimization, certain types of setup, software updates & upgrades, ect (beyond WordPress).

We all start somewhere, including myself, and including those who do this for a living day-to-day, this is just a quick note (or warning) that you will be responsible for handling these tasks, and they are things that need to be done as a part of managing a VPS and/or Dedicated server.

Have another answer? Share your knowledge.