Unknown collation: 'utf8mb4_0900_ai_ci'; This error is because the local server and live server have different versions of MYSQL. To solve this error follow the step guideline.
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.
- 1. Open your .sql file in any editor, Which you imported from the MYSQL server.
- 2. Find 'utf8mb4_0900_ai_ci' With given table name.
- 3. Replace and save the .sqi file and upload it to the MYSQL server.
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Goto to your .sql file, and replace it with
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Example With Posts Table
CREATE TABLE `posts` ( `id` bigint UNSIGNED NOT NULL, `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `post_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `source_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; // REMOVE THIS
Replace with the below ENGINE=InnoDB.
CREATE TABLE `posts` ( `id` bigint UNSIGNED NOT NULL, `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `post_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `source_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; // ADD THIS
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel 6 installation with MongoDB Database
- Postgres Database Export
- Install PostgreSQL Ubuntu 20.04 With pgAdmin4
- MongoDB Database Connection In Laravel
- Unique violation: 7 ERROR: duplicate key value violates unique constraint "users_pkey" DETAIL: Key (id)=(1) already exists.
- SOLVED # 1118 Row size too large 8126. Changing some columns to TEXT or BLOB
- How To Improve SQL Query Performance
- [FIXED] Unknown Collation: utf8mb4_0900_ai_ci In MYSQL
- Create Database In MYSQL Using PHP Script Example
- How to See Pgsql Database List in Ubuntu