php phpmysql 错误 - #1273 - #1273 - 未知排序规则:'utf8mb4_general_ci'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21190523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
phpmysql error - #1273 - #1273 - Unknown collation: 'utf8mb4_general_ci'
提问by Trevor Wood
I have just installed PhpMyAdmin v4.1.5 English only
我刚刚安装了 PhpMyAdmin v4.1.5 仅英文
I have set it up to access 2 servers - the local one on my PC and the remote one on my server
我已将其设置为访问 2 台服务器 - 我电脑上的本地服务器和服务器上的远程服务器
All is fine for my local PC but when I log in to my remote server I get the message
我的本地 PC 一切正常,但是当我登录到我的远程服务器时,我收到了消息
Error
错误
MySQL said:
MySQL 说:
#1273 - Unknown collation: 'utf8mb4_general_ci'
#1273 - 未知排序规则:'utf8mb4_general_ci'
Searching the PhpMyAdmin code finds one reference to this in DatabaseInterface.class.php
搜索 PhpMyAdmin 代码会在 DatabaseInterface.class.php 中找到对此的一个引用
if (PMA_MYSQL_INT_VERSION > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';
} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
}
No idea what this is but it seems to be setting the default charset & collation wrongly
不知道这是什么,但它似乎错误地设置了默认字符集和排序规则
回答by shaunsantacruz
1) Click the "Export" tab for the database
1) 单击数据库的“导出”选项卡
2) Click the "Custom" radio button
2) 单击“自定义”单选按钮
3) Go the section titled "Format-specific options" and change the dropdown for "Database system or older MySQL server to maximize output compatibility with:" from NONE to MYSQL40.
3) 转到标题为“特定格式选项”的部分,并将“数据库系统或较旧的 MySQL 服务器以最大限度地提高输出兼容性:”的下拉列表从 NONE 更改为 MYSQL40。
4) Scroll to the bottom and click "GO".
4) 滚动到底部并单击“开始”。
If it's related to wordpress, more infoon why it is happening.
如果它与 wordpress 相关,请提供有关其发生原因的更多信息。
回答by Anurag Srivastava
You can fix this issue by deleting browser cookie from the begining of time. I have tried this and it is working fine for me.
您可以通过从一开始就删除浏览器 cookie 来解决此问题。我已经尝试过这个,它对我来说很好用。
To delete only cookies:
仅删除 cookie:
- hold down ctrl+shift+delete
- remove all check boxes except for cookies of course
- use the drop down on top to select "from the beginning of time
- click clear browsing data
- 按住 ctrl+shift+delete
- 当然,删除除 cookie 之外的所有复选框
- 使用顶部的下拉菜单选择“从时间开始
- 点击清除浏览数据
回答by ggedde
There are two steps to fix this.
有两个步骤可以解决这个问题。
First edit phpMyAdmin/libraries/DatabaseInterface.class.php
首先编辑phpMyAdmin/libraries/DatabaseInterface.class.php
Change:
改变:
if (PMA_MYSQL_INT_VERSION > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';
} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
}
To:
到:
//if (PMA_MYSQL_INT_VERSION > 50503) {
// $default_charset = 'utf8mb4';
// $default_collation = 'utf8mb4_general_ci';
//} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
//}
Then delete this cookie from your browser "pma_collation_connection".
Or delete all Cookies.
然后从您的浏览器“pma_collation_connection”中删除这个 cookie。
或删除所有 Cookie。
Then restart your phpMyAdmin.
然后重新启动您的 phpMyAdmin。
(It would be nice if phpMyAdmin allowed you to set the charset and collation per server in the config.inc.php)
(如果 phpMyAdmin 允许您在 config.inc.php 中设置每个服务器的字符集和排序规则,那就太好了)
回答by Vescanarius
When you export you use the compatibility system set to MYSQL40. Worked for me.
导出时,您使用设置为MYSQL40. 为我工作。
回答by dknight
I had read yesterday that the issue was fixed for someone when that person cleared cookies. I had tried that but it did not work for me.
我昨天读到,当某人清除 cookie 时,该问题已为某人解决。我试过了,但它对我不起作用。
Checking the following section in DatabaseInterface.class.php,
检查 DatabaseInterface.class.php 中的以下部分,
define(
'PMA_MYSQL_INT_VERSION',
PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', true)
);
I figured that somehow cache is the problem. So, I remembered that I was restarting the service instead of doing a startand stop.
我认为以某种方式缓存是问题所在。所以,我记得我是在重新启动服务而不是执行startand stop。
# restart the service
systemd restart php-fpm
# start and stop the service
systemd stop php-fpm
systemd start php-fpm
Doing a stopfollowed by a startfixed the issue for me.
为我做一个stop然后start修复这个问题。
回答by Tan Hong Tat
Is your MySQL server version 5.5.3 or greater?
您的 MySQL 服务器版本是 5.5.3 或更高版本吗?
The utf8mb4, utf16, and utf32 character sets were added in MySQL 5.5.3.
MySQL 5.5.3 中添加了 utf8mb4、utf16 和 utf32 字符集。
http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-sets.html
http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-sets.html

