错误:未知字符集:'utf8_unicode_ci'

时间:2023-01-06 11:39:45

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?

在从mysql命令行创建一个带有字符集的数据库后,我得到了以下错误:未知字符集:utf8_unicode_ci。但是,当我在phpmyadmin中运行相同的SQL时,它可以正常工作,没有错误,我不知道为什么?

The SQL:

SQL:

CREATE DATABASE sx CHARACTER SET =utf8 COLLATE = utf8_unicode_ci;

mysql command line:

mysql命令行:

mysql -u root -ppassword  -h localhost --default-character-set=utf8

2 个解决方案

#1


10  

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.

因为您得到了错误未知的字符集:'utf8_unicode_ci',您必须指定utf8_unicode_ci(这是一个排序)作为字符集。检查您的命令并重试。

#2


6  

Change your DB_CHARSET utf8_general_ci to utf8

将您的DB_CHARSET utf8_general_ci更改为utf8。

#1


10  

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.

因为您得到了错误未知的字符集:'utf8_unicode_ci',您必须指定utf8_unicode_ci(这是一个排序)作为字符集。检查您的命令并重试。

#2


6  

Change your DB_CHARSET utf8_general_ci to utf8

将您的DB_CHARSET utf8_general_ci更改为utf8。