Asked 6 years ago
18 May 2017
Views 1397
fatso

fatso posted

Unknown character set: 'utf8mb4'

i having a SQL query:



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 ) NOT NULL COMMENT  'The unique name for the asset.\n',
 `title` VARCHAR( 100 ) NOT NULL COMMENT  'The descriptive title for the asset.',
 `rules` VARCHAR( 5120 ) 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 COLLATE = utf8mb4_unicode_ci AUTO_INCREMENT =119;


after run it getting error ::
#1115 - Unknown character set: 'utf8mb4'

hanuman

hanuman
answered Oct 8 '21 00:00

it is working fine at my MySQL.
So maybe you have not upgraded the MySQL version so try to upgrade it. it will work sure.
jaydeep

jaydeep
answered Oct 8 '21 00:00

set DEFAULT CHARSET to utf8 and it will work so new changed query is like below

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 ) NOT NULL COMMENT  'The unique name for the asset.\n',
 `title` VARCHAR( 100 ) NOT NULL COMMENT  'The descriptive title for the asset.',
 `rules` VARCHAR( 5120 ) 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 = utf8 COLLATE = utf8mb4_unicode_ci AUTO_INCREMENT =119;


please check is it working for at your MySQL or not ?
Post Answer