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

Jennifer Hinkle
Jennifer Hinkle
8,365 Points

Migrating a site- MySQL error

Hello,

I'm following the How to Build a Wordpress Theme and am at the stage where I'm migrating my site to my server. When I tried uploading my database .sql file I got an error (displayed below). I tried googling about a #1064 error, but I don't really know much about databases in the first place so other people's similar problems didn't help.

I can't make sense of it. It mentions Ninja forms, a plugin that I tried using at one point. But I ended up not using it and I deactivated/ deleted it from my dashboard before I even tried backing up my site. I tried reinstalling the plugin to see if that would fix the error, but it didn't work.

Any ideas on what this means? Or what I should do differently to fix it?

As always, thanks for any help/ advice!

Jenn

SQL query:

Data contents of table wpWPP_ninja_forms (1 records)

INSERT INTO wpWPP_ninja_forms VALUES ( 1, 'a:21:{s:10:"form_title";s:12:"Contact Form";s:10:"show_title";s:1:"0";s:9:"save_subs";s:1:"1";s:9:"logged_in";s:1:"0";s:11:"append_page";s:0:"";s:4:"ajax";s:1:"0";s:12:"landing_page";s:0:"";s:14:"clear_complete";s:1:"1";s:13:"hide_complete";s:1:"1";s:11:"success_msg";s:41:"You form has been successfully submitted.";s:10:"email_from";s:19:"hinklej15@gmail.com";s:10:"email_type";s:4:"html";s:12:"user_subject";s:28:"Thank you for contacting us!";s:14:"user_email_msg";s:69:"Thank you so much for contacting us. We will get back to you shortly.";s:17:"user_email_fields";s:1:"0";s:12:"admin_mailto";a:1:{i:0;s:0:"";}s:13:"admin_subject";s:0:"";s:15:"admin_email_msg";s:0:"";s:18:"admin_email_fields";s:1:"1";s:16:"admin_attach_csv";s:1:"0";s:15:"email_from_name";s:17:"Breath is Limited";}', 2013 -12 -0521 :43 :37 ) ;

MySQL said: Documentation

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '21:43:37)' at line 1

3 Answers

No problem! It can all be a bit overwhelming at first. Firstly, I assumed you were migrating the file manually, my apologies. So, scratch everything I said before. Basically this data is irrelevant and the only thing you should have to do is delete the 'wppWPP_ninja_forms' table from your database, then re-export your .sql file and re-import it wherever it needs to go. I'm not sure what you are using to manage your database, but if you use something like Sequel Pro for Mac, deleting a table is as simple as option-clicking and selecting 'Delete Table', however I'm going to assume that you are probably using something like phpmyadmin. If that is the case, then I would recommend you start at www.phpmyadmin.net for information on how to delete tables from your database. This is also a fairly good article on getting up and running with phpmyadmin for WordPress: http://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-database-management-with-phpmyadmin/

Deleting that table should solve your problem, if you aren't using that Ninja Forms plugin anymore.

Let me know if you run into any snags!

Jennifer Hinkle
Jennifer Hinkle
8,365 Points

Hello again Patrick,

Thanks so much for your help! That's exactly what I needed to do. Site is now up and running!

Thanks so much!! Jenn

Christophe Rudyj
seal-mask
.a{fill-rule:evenodd;}techdegree
Christophe Rudyj
Full Stack JavaScript Techdegree Student 13,011 Points

The best way i found for migrating its to use the import export option of wordpress as it does the heavy lifting it self even custom post

The MySQL Error is referring to the time element of your insert statement. Essentially what this query is saying is : insert into my_table the following junk: id = 1 content = (serialized array) when? = time

Time should be formatted as follows -- 'YYYY-MM-DD HH:mm:ss' which, if you use the PHP date() function would look like this:

date("Y-m-d H:i:s', $date)

In MySQL it would just be to reformat the time string of the insert from

2013 -12 -0521 :43 :37

to

'2013-12-05 21:43:37' (with the single quotes).

Let me know if that doesn't make sense or you need more clarification. Syntax can be a little tricky on the outset.

Patrick

Jennifer Hinkle
Jennifer Hinkle
8,365 Points

Hi Patrick thanks so much for the help!

When you say insert

'2013-12-05 21:43:37'

into my_table, what exactly is my_table? And where should I insert something into it? I don't really understand why the error occurred in the first place either. Would you mind clarifying a little more on how I fix this? Also, I'd like to gain a better understanding of how/ why these types of errors occurred. Would you suggest I learn more about databases to do so?

Thanks again for your help!

Jenn