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
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.
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".
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.
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.
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.
Change your DB_CHARSET utf8_general_ci to utf8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With