Instructions for handling sample table error Unknown collation: 'utf8mb4_unicode_520_ci'

October 3, 2022 36hotness 0likes 0comments


In this article, I will guide you to handle the case that occurs on the operating system when importing the database, an error message appears: Unknowing collation: “utf8mb4_unicode_520_ci”

The first reason is due to incompatibility between MySQL versions for example in localhost you use MySQL 5.7 but on real hosting you use MySQL 5.5. Starting from WordPress version 4.2, the WordPress database uses charset utf8mb4, so if your hosting is still using an old version of MySQL that does not support utf8mb4, then you will get the same error when importing. Try the following ways to fix the above error.

Screenshot 223

Method 1: Check if the current version is using PHP and MySQL, if you are still using the old version, please upgrade to the latest version (You are renting VPS) or ask the hosting provider upgrade to the new version to help fix this.

Screenshot 224

In case the service provider refuses this upgrade for fear of affecting other customers sharing the same hosting on the server, please move to the below method.

Way 2

Fix Unknown collation: 'utf8mb4_unicode_520_ci' with this way you just export the data normally in the default form then you open the downloaded data file with Notepad or Notepad++. Here I use Notepad++ to edit.

After downloading the Notepad++ installation theme on your personal computer, you proceed to open the database file by right-clicking on the file and selecting Edit Text Notepad++.

Screenshot 225

Open the file on the board, you will find the nearest table, you will see that the table uses the utf8mb4_unicode_520_ci encoding. then you press Ctrl + H and choose to replace the line utf8mb4_unicode_520_ci with the line utf8mb4_unicode_ci then save and try to import that data file and phpmyadmin on the new host to see if the error is still there. If it's over, it's ok. If the error is still there, you can fix it as follows.

sua loi database lỗi UTF8mb4

You press Ctrl + H again and replace the line utf8mb4 with utf8 and then save and upload to the host. This time it will definitely succeed.

Note: Maybe when replacing utf8mb4 to utf8 your website will have a font error (Vietnamese font). To fix this error, just open the wp-config.php file and find and replace the define('DB_CHARSET','utf8mb4′) with define('DB_CHARSET', 'utf8') and it will be ok.

Epilogue

So you know the cause and how to fix the Unknown collation error: 'utf8mb4_unicode_520_ci' when uploading data to phpmyadmin in the new host. In those ways to optimize, you should ask the host provider to upgrade the MySQL version, otherwise you can use the remaining ways to fix the error. Good luck!



Source link

hostadmin

This person is a lazy dog and has left nothing

Comments