#1273 – Unknown collation: ‘utf8mb4_unicode_520_ci

2019-01-12 17:40发布

I have a WordPress website on my local WAMP server. But when I upload its database to live server, I get error

#1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’

Any help would be appreciated!

8条回答
ゆ 、 Hurt°
2楼-- · 2019-01-12 18:00

easy replace

sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' your_sql_file.sql
查看更多
淡お忘
3楼-- · 2019-01-12 18:03

I believe this error is caused because the local server and live server are running different versions of MySQL. To solve this:

  1. Open the sql file in your text editor
  2. Find and replace all utf8mb4_unicode_520_ci with utf8mb4_unicode_ci
  3. Save and upload to a fresh mySql db

Hope that helpsenter image description here

查看更多
神经病院院长
4楼-- · 2019-01-12 18:05

You can solve this by finding

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

in your .sql file, and swapping it with

ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
查看更多
迷人小祖宗
5楼-- · 2019-01-12 18:08

Open the sql file in your text editor;

1. Search: utf8mb4_unicode_ci Replace: utf8_general_ci (Replace All)

2. Search: utf8mb4_unicode_520_ci Replace: utf8_general_ci (Replace All)

3. Search: utf8mb4 Replace: utf8 (Replace All)

Save and upload!

查看更多
别忘想泡老子
6楼-- · 2019-01-12 18:11

just remove "520_"
utf8mb4_unicode_520_ciutf8mb4_unicode_ci

查看更多
啃猪蹄的小仙女
7楼-- · 2019-01-12 18:11

Late to the party, but in case this happens with a WORDPRESS installation :

#1273 - Unknown collation: 'utf8mb4_unicode_520_ci

In phpmyadmin, under export method > Format-specific options( custom export )

Set to : MYSQL40

If you will try to import now, you now might get another error message :

1064 - You have an error in your SQL syntax; .....

That is because The older TYPE option that was synonymous with ENGINE was removed in MySQL 5.5.

Open your .sql file , search and replace all instances

from TYPE= to ENGINE=

Now the import should go smoothly.

查看更多
登录 后发表回答