Asked 7 years ago
18 May 2017
Views 1738
fatso

fatso posted

Unknown collation: 'utf8mb4_unicode_ci'


CREATE TABLE IF NOT EXISTS `jfzq8_assets` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', `parent_id` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set parent.', `lft` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set lft.', `rgt` int(11) NOT NULL DEFAULT '0' COMMENT 'Nested set rgt.', `level` int(10) unsigned NOT NULL COMMENT 'The cached level in the nested tree.', `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.\n', `title` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The descriptive title for the asset.', `rules` varchar(5120) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'JSON encoded access control.', PRIMARY KEY (`id`), UNIQUE KEY `idx_asset_name` (`name`), KEY `idx_lft_rgt` (`lft`,`rgt`), KEY `idx_parent_id` (`parent_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLL[...]




angeo

angeo
answered Jun 24 '23 00:00

The error message " Unknown collation: 'utf8mb4_unicode_ci' " indicates that the collation specified for the character set in your MySQL database is not recognized. To resolve this issue, you can follow these steps:

Open the file where the SQL query is located.

Locate the line that sets the collation for the table. In your provided code snippet, it is COLLATE utf8mb4_unicode_ci.

Replace utf8mb4_unicode_ci with a collation that is recognized by your MySQL database. Some commonly used collations for the utf8mb4 character set are utf8mb4_general_ci and utf8mb4_bin .

Save the changes to the file.

For example, you can modify the collation line to be:



`name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'The unique name for the asset.\n'

Make sure to apply the same change to all the other fields that specify the collation.
Post Answer