简体   繁体   English

phpMyAdmin导出数据库

[英]phpMyAdmin export database

I use Mamp 3.4. 我使用Mamp 3.4。 I have a small database with 3 tables. 我有一个带有3个表的小型数据库。 When I upload the database file to the server I have that error: #1115 - Unknown character set: 'utf8mb4' 当我将数据库文件上传到服务器时,出现以下错误:#1115-未知字符集:'utf8mb4'

I have gone back to MAMP and check: Operations > Collation > utf8_unicode_ci I have that in each table and in the general database 我回到MAMP并检查:“操作”>“排序规则”>“ utf8_unicode_ci”,我在每个表和常规数据库中都有该设置

To export I select the database > Export > Custom > Save Output to a file. 要导出,我选择数据库>导出>定制>将输出保存到文件。 In the rest of things I leave the default. 在其余的事情中,我保留默认值。

Where is the problem? 问题出在哪儿? what is that mb4? 那mb4是什么? is the utf8_unicode_ci the right one? utf8_unicode_ci是正确的吗? How to export from MAMP and import in my server? 如何从MAMP导出并导入我的服务器?

Let's get one thing straight: character set is not the same as collation. 让我们直接讲一件事:字符集与排序规则不同。 The two concepts are closely realted only. 这两个概念仅紧密结合。

Character sets tell the programs processing text how to interpret the byte stream that makes up the text and what character to display on the screen. 字符集告诉处理文本的程序如何解释构成文本的字节流以及在屏幕上显示什么字符。

Collations tell the programs processing text how to order characters for comparison and sorting purposes. 排序规则告诉处理文本的程序如何为比较和排序目的排序字符。 So, if you do an order by on a text field in an RDBMS, then the RDBMS can figure out using the collation the order of the records. 因此,如果您对RDBMS中的文本字段执行排序,则RDBMS可以使用排序规则来确定记录的顺序。

utf8mb4 is a character set MySql uses. utf8mb4是MySql使用的字符集。 MySql's implementation of utf8 can represent a character on up to 3 bytes, while utf8mb4 can represent characters on up to 4 bytes. MySql的utf8实现可以表示最多3个字节的字符,而utf8mb4最多可以表示4个字节的字符。 The utf8 standard uses the up to 4 bytes definition ( utf8, wikipedia ), so strictly speaking, utf8mb4 is the true utf8 implementation in mysql. utf8标准使用最多4个字节的定义( utf8,Wikipedia ),因此严格来说,utf8mb4是mysql中真正的utf8实现。

However, utf8mb4 has only been added relatively recently (v5.5.3), so its existence is still not that widely known in the mysql community ( MySql utf8mb4 ). 但是,utf8mb4只是在最近才添加的(v5.5.3),因此它的存在在mysql社区( MySql utf8mb4 )中还不是很广为人知。

If you try to import data using this character set to a database that does not support it, then you get the error message in your question. 如果您尝试使用此字符集将数据导入不支持该字符集的数据库,则会在您的问题中收到错误消息。

Collation should match the encoding, so if you have utf8mb4 character set, then use an utf8mb4 collation as well. 排序规则应与编码匹配,因此,如果您具有utf8mb4字符集,则也应使用utf8mb4排序规则。 You need to convert your data to a character set that is supported by your target system and you need to align the collation with your encoding. 您需要将数据转换为目标系统支持的字符集,并且需要使排序规则与编码对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM