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

Wes Beale
Wes Beale
2,364 Points

mySQL import error

I'm migrating my local wp database to a live server and it keeps spitting this error back at me:

SQL query:

CREATE TABLE wp_commentmeta ( meta_id bigint( 20 ) unsigned NOT NULL , comment_id bigint( 20 ) unsigned NOT NULL DEFAULT '0', meta_key varchar( 255 ) COLLATE utf8mb4_unicode_ci DEFAULT NULL , meta_value longtext COLLATE utf8mb4_unicode_ci ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci AUTO_INCREMENT =1;

MySQL said: Documentation

1273 - Unknown collation: 'utf8mb4_unicode_ci'

I've tried to read mySQL's docs and I'm still having trouble understanding.

any help would be greatly appreciated. thanks!

1 Answer

Jacobus Hindson
Jacobus Hindson
14,429 Points

Hi Wes,

Its about the character set that your sql statement is passing try this:

Change

DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci 

to

DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci
Wes Beale
Wes Beale
2,364 Points

Where can I find those options and change them? Sorry, I am super lost! I tried making a change to the collation here: http://i.imgur.com/KxwAxra.png

That didn't do the trick for me.

Jacobus Hindson
Jacobus Hindson
14,429 Points

Hi Wes,

Looks like you may have a issue with your versions of SQL not matching, the mb4 collation you are using was introduced in V5.5 and many server are still running 5.2-5.4 as native hence you cannot import your DB.

If you are using cPanel or Plesk on the hosting service you can go to PHP settings and upgrade the level of php (presuming your host allows clients to do this). If not it may require a command line update.

Get in touch with your server admins and check what version of PHP is running.