Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: Unknown character set: 'utf8_unicode_ci'

Upon creating a database from the mysql command line with character sets, I get the following error: Unknown character set: utf8_unicode_ci. But, when I run the same SQL in phpmyadmin, it works fine with no errors and I cant figure out why?

The SQL:

CREATE DATABASE sx CHARACTER SET =utf8 COLLATE = utf8_unicode_ci;

mysql command line:

mysql -u root -ppassword  -h localhost --default-character-set=utf8
like image 221
Henrik Sandin Avatar asked Sep 29 '13 11:09

Henrik Sandin


People also ask

What is utf8_unicode_ci in MySQL?

utf8_unicode_ci also supports contractions and ignorable characters. utf8_general_ci is a legacy collation that does not support expansions, contractions, or ignorable characters. It can make only one-to-one comparisons between characters.

What is utf8_unicode_ci?

utf8_unicode_ci uses the standard Unicode Collation Algorithm, supports so called expansions and ligatures, for example: German letter ß (U+00DF LETTER SHARP S) is sorted near "ss" Letter Œ (U+0152 LATIN CAPITAL LIGATURE OE) is sorted near "OE".

What is collate utf8_unicode_ci?

In short: utf8_unicode_ci uses the Unicode Collation Algorithm as defined in the Unicode standards, whereas utf8_general_ci is a more simple sort order which results in "less accurate" sorting results.

What is utf8mb4 character set?

utf8mb4 : A UTF-8 encoding of the Unicode character set using one to four bytes per character. utf8mb3 : A UTF-8 encoding of the Unicode character set using one to three bytes per character. This character set is deprecated in MySQL 8.0, and you should use utfmb4 instead.


2 Answers

Since you're getting the error Unknown character set: 'utf8_unicode_ci', you must be specifying utf8_unicode_ci (which is a collation) as the character set. Check your command and try again.

like image 134
eggyal Avatar answered Sep 27 '22 17:09

eggyal


Change your DB_CHARSET utf8_general_ci to utf8

like image 41
Nabin Avatar answered Sep 27 '22 16:09

Nabin