我在本地WAMP服务器上有一个WordPress网站。但当我上传它的数据库到活服务器,我得到错误

#1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’

任何帮助都将不胜感激!


当前回答

简单的替换

sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' your_sql_file.sql

其他回答

我相信这个错误是因为本地服务器和活动服务器正在运行不同版本的MySQL。要解决这个问题:

在文本编辑器中打开sql文件 用utf8mb4_unicode_ci替换所有utf8mb4_unicode_ci 保存并上传到一个新的mySql数据库

移除“520_” utf8mb4_unicode_520_ci→utf8mb4_unicode_ci

在文本编辑器中打开sql文件;

1. 搜索:utf8mb4_unicode_ci替换:utf8_general_ci(替换全部)

2. 搜索:utf8mb4_unicode_520_ci替换:utf8_general_ci(替换全部)

3.搜索:utf8mb4替换:utf8(替换全部)

保存并上传!

简单的替换

sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' your_sql_file.sql

Getting collation error #1273 - Unknown collation: 'utf8mb4_unicode_520_ci' is caused by the difference of the MySQL version from which you export and our MySQL server to which you import. Basically, the Wordpress library for newer version checks to see what version of SQL your site is running on. If it uses MySQL version 5.6 or more, it assumes the use of a new and improved Unicode Collation Algorithm (UCA) called “utf8mb4_unicode_520_ci”. This is great unless you end up moving your WordPress site from a newer 5.6 version of MySQL to an older, pre 5.6 version of MySQL.

要解决这个问题,你必须编辑你的SQL导出文件,并进行搜索和替换,将' utf8mb4_unicode_520_ci '的所有实例更改为' utf8mb4_unicode_ci '。如果你有PHPMyAdmin,也可以按照下面的步骤:

单击数据库的Export选项卡 单击Custom单选按钮。 进入“特定格式选项”部分,更改数据库系统或旧MySQL服务器的下拉菜单,以最大限度地提高输出兼容性:从NONE到MYSQL40。 滚动到底部并单击GO。