Jamshaid Ali

Environment Details

Database server

  • Server: Localhost via UNIX socket
  • Server type: MariaDB
  • Server connection: SSL is not being used 
  • Server version: 10.5.23-MariaDB-0+deb11u1 – Debian 11
  • Protocol version: 10
  • User: someone@localhost
  • Server charset: UTF-8 Unicode (utf8mb4)

Web server

  • Apache/2.4.56 (Debian)
  • Database client version: libmysql – mysqlnd 7.4.33
  • PHP extension: mysqli  curl  mbstring 
  • PHP version: 7.4.33

phpMyAdmin

  • Version information: 5.0.4deb2+deb11u1

The collation utf8mb4_0900_ai_ci is a character set collation for MySQL databases, introduced in MySQL 8.0.1. It is based on the Unicode Collation Algorithm (UCA) 9.0.0, and the character set is utf8mb4, which supports a wide range of Unicode characters.

The “ai” in the collation name stands for “accent insensitive” and the “ci” stands for “case insensitive.” This means that comparisons between characters are done without considering differences in case or accents.

If you are receiving an “Unknown collation” error, it may be because your MySQL server version is older than 8.0.1 and doesn’t support this collation. To fix this issue, you can:

Problem

I got the below error while restoring a database on another server. The collation id may differ based on the MySQL version.

#1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’

Solution

  1. Edit the database backup file in text editor and replace “utf8mb4_0900_ai_ci” with “utf8mb4_general_ci” and “CHARSET=utf8mb4” with “CHARSET=utf8“.
  2. Replace the below string:
    • ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8mb4_general_ci;
      • With:
    • ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Here we are changing the CHARSET to utf8, that is the older version and have limitation. Read the implications at the end of this article before making the changes in database.

Save your file and restore the database.

Limitations of UTF8 Character Set:

Changing the character set from utf8mb4 to utf8 in MySQL is not inherently bad, but it may have some implications that you should consider before making the change:

Source: https://tecadmin.net/resolved-unknown-collation-utf8mb4_0900_ai_ci/

Subscribe For Update

Stay up to date with the latest development and news.

© Copyright Powered by WPDeveloper - Built by Jamshaid Ali

HTML Snippets Powered By : XYZScripts.com