Unknown Collation [FIXED] : utf8mb4_0900_ai_ci In MYSQL
Unknown Collation [FIXED] : utf8mb4_0900_ai_ci In MYSQL
Published Jan 12,2023 by Kailash Singh
0 Comment 11664 Views
In this post, we are going to teach you, how to fixed unknown collation utf8mb4_0900_ai_ci error In MYSQL.
Unknown collation: 'utf8mb4_0900_ai_ci': This error is because the local server and live server have different versions of MYSQL. It means the error is because of a different version of MYSQL from were you exporting your SQL database and where you importing also a different version of MYSQL.
To solve this error follow the step guideline:
- Open your .sql file in any editor(Notepad), Which you imported from the MYSQL server.
- Find 'utf8mb4_0900_ai_ci' With given table name.
- Replace and save the .sql file.
- Upload it to the MYSQL server.
Error Line in your SQL file:
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Solution: Open your .sql file, and replace it with this code.
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Previous SQL Example:
CREATE TABLE `studnet` (
`id` bigint UNSIGNED NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; // REMOVE THIS LINE
Correct SQL Example:
CREATE TABLE `studnet` (
`id` bigint UNSIGNED NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; // ADD THIS LINE
Comments ( 0 )
Elevenstech Web Tutorials
Elevenstech Web Tutorials helps you learn coding skills and enhance your skills you want.
As part of Elevenstech's Blog, Elevenstech Web Tutorials contributes to our mission of “helping people learn coding online”.
Read More
Newsletter
Subscribe to get the latest updates from Elevenstech Web Tutorials and stay up to date