• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

[Solved] Unknown collation: utf8mb4_0900_ai_ci

Written by Admin, Updated On June 11, 2021
database, mariadb, mysql
[Solved] Unknown collation: utf8mb4_0900_ai_ci

A collation means a predefined rules to compare and sort character strings in a database server. Generally, this error occurs during the database restoration on another server. In this guide, we will show you how to fix Unknown collation: utf8mb4_0900_ai_ci error.

Let us discuss the cause and solution about the issue:

Problem – Unknown collation: utf8mb4_0900_ai_ci#

When you migration any web application to another server, you might get the following error at the time of database restore. The collation id may difference based on MySQL version.

Error message:

Error 1273 (HY000): Unknown collation: 'utf8mb4_0900_ai_ci'

Solution#

This type of error occurs when a MySQL destination server has older version than the source server. We found the solution and the the destination server doesn’t required database collation.

Edit the database backup file using your favorite text editor and replace utf8mb4_0900_ai_ci with utf8mb4_general_ci and CHARSET=utf8mb4 with CHARSET=utf8.

Replace below string:

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

with:

ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

Save and close the file.

In Linux systems, you can use the sed command to replace text in file directly.

sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' backup.sql
sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' backup.sql

All done. Now your database should restore successfully.

Conclusion#

I hope this guide helped you to fix Unknown collation: utf8mb4_0900_ai_ci issue.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Gulp.js on Ubuntu 20.04
Next Article   [Resolved] Cron job wget writing files to root directory

Related Posts

  • How to Install WordPress with Nginx on Debian 11

    How to Install WordPress with Nginx on Debian 11

    March 22, 2023
  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook