更改 phpmyadmin 中的默认排序规则
在我看来,phpMyAdmin 默认使用排序规则 latin1_swedish_ci 导入表,我如何更改它?
It seems to me that phpMyAdmin imports tables by default with collation latin1_swedish_ci, how i change this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
在您的 Mysql 配置中,更改 [mysqld] 选项卡下的默认字符集操作。 例如:
之后不要忘记重新启动 Mysql 服务器以使更改生效。
In your Mysql configuration change the default-character-set operative under the [mysqld] tab. For example:
Don't forget to restart your Mysql server afterwards for the changes to take effect.
对于 Linux:
您需要有权访问 MySQL 配置文件。
该位置可能有所不同,从
/etc/mysql/my.cnf
到~/my.cnf
(用户目录)。在
[mysqld]
部分添加以下行:重新启动服务器:
For Linux:
You need to have access to the MySQL config file.
The location can vary from
/etc/mysql/my.cnf
to~/my.cnf
(user directory).Add the following lines in the section
[mysqld]
:Restart the server:
这不是 phpMyAdmin 问题。
排序规则是最新 MySQL 版本的一部分,您必须设置服务器(或至少是数据库)的默认排序规则才能更改该行为。
要将已导入的表转换为 UTF-8,您可以执行以下操作(在 PHP 中):
代码片段取自 此处。
This is not a phpMyAdmin question.
Collations are part of recent MySQL releases, you must set the default collation of the server (or at least of the database) to change that behaviour.
To convert already imported tables to UTF-8 you can do (in PHP):
Code snippet taken from here.
对于
utf8mb4
,在[mysqld]
部分中添加/更改以下内容:然后重新启动
mysql
服务(对于 Ubuntu,命令为sudo 服务 mysql 重新启动
)For
utf8mb4
, add/change the following in the[mysqld]
section:Then restart the
mysql
service (for Ubuntu the command issudo service mysql restart
)知道这是一个旧帖子。 但我通过phpMyAdmin更改默认字符集的方式是:
phpMyadmin主页> 变量选项卡(服务器变量和设置)> 搜索“character”并将所有变量从“latin1”更改为“utf8”。
(在使用 phpMyAdmin v.3.5.7 的 MAMP 安装上)
正如其他人所说,这是 MySQL 的变量,而不是某些 phpMyAdmin 特定的变量。
know this is an old post. But the way i changed the default charset through phpMyAdmin was:
phpMyadmin main page > Variables tab (Server variables and settings) > searched for "character" and changed all variables from "latin1" to "utf8".
(on a MAMP installation with phpMyAdmin v. 3.5.7)
And as the others said, this is the variables for MySQL and not some phpMyAdmin specific ones.
MySQL DB « 更改排序规则 数据库名称|表为
utf8_general_ci
以支持 Unicode。更改
XAMPP 的配置设置文件:
从配置设置文件中取消注释
UTF 8 Settings
«D:\xampp\mysql\bin\my.ini
让 MySQL 服务器支持 UTF8 以及文件中的以下代码行
my.cnf
@see
MySQL DB « change Collation Name of a Database|Table to
utf8_general_ci
inorder to support Unicode.Change Configuration settings file also
XAMPP:
uncomment
UTF 8 Settings
from the Configuration settings file «D:\xampp\mysql\bin\my.ini
For MySQL server to support UTF8 and the below line of code in file
my.cnf
@see
my.ini
(或my.cnf
)config.inc.php
您需要重新启动MySQL 服务器并删除 cookie、所在域的数据 PhpMyAdmin
使用PhpMyAmdin重新加载页面并查看结果
< a href="https://i.sstatic.net/hCHVF.png" rel="nofollow noreferrer">
my.ini
(ormy.cnf
)config.inc.php
You need to restart MySQL server and remove cookies,data for domain where is located PhpMyAdmin
Reload page with PhpMyAmdin and at look the result
最初的问题是关于 phpMyAdmin 中的默认设置。
我认为问题与在 phpMyAdmin 中创建新数据库有关 - 当页面显示 utf8mb4 时...
这是 phpMyAdmin 设置!
如果您希望创建新数据库时默认显示 utf8_general_ci。
将以下 2 行添加到 config.inc.php 文件中:
$cfg['DefaultCharset'] = 'utf8';
$cfg['DefaultConnectionCollation'] = 'utf8_general_ci';
$cfg['DefaultConnectionCollation'] = 'utf8_general_ci'; 代码>请参阅 phpMyAdmin 文档 https://docs.phpmyadmin.net/en/latest/config .html 和
https://docs.phpmyadmin.net/en/latest/config.html# cfg_DefaultConnectionCollation
The original question was for the default setting in phpMyAdmin.
I think the question relates to creating a NEW database in phpMyAdmin - when the page shows utf8mb4...
This IS a phpMyAdmin setting!
If you want the default for creating new databases to show utf8_general_ci.
Add the following 2 line to your config.inc.php file:
$cfg['DefaultCharset'] = 'utf8';
$cfg['DefaultConnectionCollation'] = 'utf8_general_ci';
See phpMyAdmin docs https://docs.phpmyadmin.net/en/latest/config.html and
https://docs.phpmyadmin.net/en/latest/config.html#cfg_DefaultConnectionCollation
我想改用 utf8mb4,配置必须如下:
如果将 character_set 设置为 utf8,服务器将不会启动
I wanted to use utf8mb4 instead, and the configuration had to be the following:
the server would not start if the character_set was set to
utf8