Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Local WordPress Development Local WordPress Development Migrating WordPress from Local to Live Server

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

Error in importing database to live MyPHPAdmin

I have been working on my own website locally, watched the video and managed to upload the database and everything via FTP successfully. I then worked on it again locally, exported local database and tried to import it into live MyPHPAdmin through in my CPanel but got this error:

" Error SQL query:

--

-- Database: bullfrog


--

-- Table structure for table wp_commentmeta

CREATE TABLE wp_commentmeta (

meta_id BIGINT( 20 ) UNSIGNED NOT NULL , comment_id BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0', meta_key VARCHAR( 255 ) DEFAULT NULL , meta_value LONGTEXT ) ENGINE = INNODB DEFAULT CHARSET = utf8;

MySQL said: Documentation

1050 - Table 'wp_commentmeta' already exists

"

I have tried to read up on this error in http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html but i still don't understand. it.

What's wrong?

3 Answers

Colin Marshall
Colin Marshall
32,861 Points

When you export the database, make sure you check the "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION" setting. This will drop (delete) the table if it exists and recreate it in the database you are importing it to.

Make sure you use the settings recommended in WordPress codex for exporting your WordPress database. http://codex.wordpress.org/Backing_Up_Your_Database

Some info on the "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION" http://stackoverflow.com/questions/2760460/what-does-the-add-drop-table-view-procedure-function-checkbox-do-in-phpm

Kira Nesser
Kira Nesser
790 Points

This also worked for me, thanks!

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

Last question Colin,

I just uploaded a local version of my website(through FTP and PHPMyAdmin) to an already existing live website. After doing this, I noticed that user input(comments, reviews etc) on the front end of the live site had been overwritten by the local site.

How do I work locally and safely upload changes to the website without overwriting the current live website?

I think Zac addresses this towards the end of the video....I haven't done this myself yet, but my understanding is that you need to export the LIVE server database, import it into your local development, change the DB settings so it works on your local developing environment, make any changes you need to the site locally, export all the changed files to your LIVE server (via FTP), export the LOCAL DB and finally import it using cPanel in your LIVE server.

As others have noted in other questions, there seems to be programs out there that will automate a lot of this for you like BackupBuddy.